android meteor cordova项目中的Kotlin版本不匹配,无任何变更

xggvc2p6  于 2023-03-16  发布在  Android
关注(0)|答案(1)|浏览(139)

我有一个Meteor 2.9.0(cordova-android 10)项目,工作一切正常,我可以建立它在我的Windows 10机器上成功上周.什么都没有改变,因为从那时起,从我这边,但它现在失败了,我正在运行的想法如何修复它.
我收到一些关于用不兼容版本的Kotlin编译模块的错误,主要来自PushPlugin,但我已经将这个插件硬编码到了特定的git提交中,所以不可能有任何改变。错误:

> Task :app:compileDebugKotlin FAILED
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
    C:/Users/Meteor/.gradle/caches/transforms-3/cc5cc74c45c7cc5e76733fe8278ba926/transformed/jetified-kotlin-stdlib-jdk7-1.5.20.jar (version 1.5)
    C:/Users/Meteor/.gradle/caches/transforms-3/adaf9cac4b199e0779758b8aae901bb4/transformed/jetified-kotlin-stdlib-1.7.10.jar (version 1.7)
    C:/Users/Meteor/.gradle/caches/transforms-3/eda4e3aecc1ddb0771d71f6ab843e15d/transformed/jetified-kotlin-stdlib-common-1.7.10.jar (version 1.7)
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
e: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors
e: C:/Users/Meteor/.gradle/caches/modules-2/files-2.1/androidx.annotation/annotation/1.5.0/857678d6b4ca7b28571ef7935c668bdb57e15027/annotation-1.5.0.jar!/META-INF/annotation.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/Meteor/.gradle/caches/transforms-3/adaf9cac4b199e0779758b8aae901bb4/transformed/jetified-kotlin-stdlib-1.7.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible 
version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/Meteor/.gradle/caches/transforms-3/eda4e3aecc1ddb0771d71f6ab843e15d/transformed/jetified-kotlin-stdlib-common-1.7.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: D:\GIT\meteor-app\.meteor\local\cordova-build\platforms\android\app\src\main\java\com\adobe\phonegap\push\BackgroundActionButtonHandler.kt: (14, 2): Class 'kotlin.Suppress' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
The class is loaded from C:/Users/Meteor/.gradle/caches/transforms-3/adaf9cac4b199e0779758b8aae901bb4/transformed/jetified-kotlin-stdlib-1.7.10.jar!/kotlin/Suppress.class

我尝试将PC上安装的Gradle版本(7.3.1)更新为7.6.1,清除.gradle/caches目录并删除整个.gradle目录。我卸载了所有Android SDK,然后在Android Studio中重新安装。我的应用面向sdk 31。
我运行的是Java JDK 11.0.17,gradle 7.3.1,但我认为meteor/cordova使用的是自己的gradle版本,因为我看到了包含gradle 7.1.1的日志。我搜索了整个项目(包括cordova构建版本)以查找硬编码的Kotlin版本,所能找到的只有:
android.json:"xml": "<preference name=\"GradlePluginKotlinVersion\" value=\"1.5.20\" />",
cdv-gradle-config.json:
"KOTLIN_VERSION": "1.5.20",
插件/@havesource/cordova插件推送/插件.xml:
<preference name="GradlePluginKotlinVersion" value="1.5.20" />
所以一切都匹配,但不知何故它抱怨Kotlin1.7.1...我已经厌倦了这个,这不是我第一次挣扎几个小时与随机的东西打破了android构建没有我碰任何东西,Android相关的东西神奇地从env变量中消失,东西停止工作...构建iOS是一种乐趣相比,这.
我知道有很多类似的问题,但是所有的问题都是关于修改gradle的设置,而我在这个项目中不能这么做,因为这都是由cordova完成的,而且它是插件。

ldioqlga

ldioqlga1#

我自己也找到了答案。似乎我不是唯一一个被困扰的人。有些东西已经自动神奇地改变了其他人也和建筑停止工作,尽管没有作出任何改变。看这里:https://github.com/havesource/cordova-plugin-push/issues/218
添加cordova首选项以使用更高的Kotlin版本修复了这一点,但我想知道发生了什么,是谁造成的

相关问题