I'm using two modules in my app, one for Android and one for WearOS. Both modules are using Jetpack Compose.
I can build my Android module without any issues using the kotlin-gradle-plugin:1.7.20
.
If I switch to the Wear module AndroidStudio outputs an error stating that it needs a different version of the kotlin-gradle-plugin
. This is the error I'm getting:
This version (1.1.1) of the Compose Compiler requires Kotlin version 1.6.10 but you appear to be using Kotlin version 1.7.20 which is not known to be compatible. Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).
Naturally I tried downgrading my Kotlin version to 1.6.10
, this however brings up a totally different issue while trying to build any module:
jetified-savedstate-ktx-1.2.1-api.jar!/META-INF/savedstate-ktx_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
I tried Invalidate caches and restart
after changing the version
To conclude:
1.7.20
1.6.10
How would you go about fixing this? As far as I know I cant specify the kotlin-gradle-plugin
version on a module basis and it needs to be in the project gradle file. I did not find a way to specify a module for the depedency in the root file like it is implemented with flavors.
Compose compiler version is closely tied to kotlin version. Since you cannot change kotlin version, you need to change compose compiler version. Right now it is 1.1.1
, change it to 1.3.2
.
Note: compose compiler is not the same thing as compose. Their versioning is independent specifically for this reason.