When I try to use a specific Kotlin version for cordova-android 9.1.0, I get error messages like:
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
That results from using:
<preference name="GradlePluginKotlinVersion" value="1.6.0" />
If I manually replace the 1.3.50 ext.kotlin_version values with 1.6.0 in the build.gradle files, then my project starts building successfully.
How can I make the build work, with my desired Kotlin version, without having to make this edit?
CodePudding user response:
I had the same problem on Cordova 9 and wasn't able to resolve it since Cordova 9 has kotlin v 1.3.50 hardcoded in the build.gradle
file.
So I upgraded to Cordova 10.1.0 and the issue was solved.
cordova platform remove android
cordova platform add android@10.1.0