Closed DiegoSestito closed 1 year ago
Same (or very similar) issue for me. It's very bizarre -- I've been quite happily building my app every few minutes, then bang... build fails. I've not added or removed any plugins, just changed some app JS.
> 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/m.beard/.gradle/caches/transforms-3/cc5cc74c45c7cc5e76733fe8278ba926/transformed/jetified-kotlin-stdlib-jdk7-1.5.20.jar (version 1.5)
C:/Users/m.beard/.gradle/caches/transforms-3/adaf9cac4b199e0779758b8aae901bb4/transformed/jetified-kotlin-stdlib-1.7.10.jar (version 1.7)
C:/Users/m.beard/.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/m.beard/.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.
I've not posted the entire error log as it goes on and on, but the key seems to be:
Class 'kotlin.somehting' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
Removing the plugin fixes the issue, but that's not really an option.
Same here. Yesterday everything was working fine.
I don't remember exactly what I did to fix this problem, because I had several problems trying to get my app to work for sdk 32. But I believe that reinstalling all my plugins in the most current version and installing jdk 11, one of these two things solved it. Maybe you should start by trying to install JDK 11.
And of course, make sure you are running the most current version of cordova and cordova-android.
Thanks, but none of that explains how the app will build without problems, but then fail a few minutes later. I'm already on JDK11. Also, the latest cordova-android is 11.0.0, which is not a trivial update to 10.1.2.
I think I was able to fix this by adding the following to my config:
<preference name="GradlePluginKotlinEnabled" value="true" />
<preference name="GradlePluginKotlinVersion" value="1.7.10" />
My build succeeds at least. No idea why this just started happening. Everything was fine a day or two ago.
preziotte - You made my day, after I lost two other days for looking for a solution. BTW it is f...g crazy when one day cordova stops compiling app without any warning.
@preziotte - worked for us too - thank you very much (our builds stopped working late last Friday after being fine all day)
Does anyone know and/or understand exactly what caused this to happen?
@preziotte thanks. I coud have sworn I'd already tried that, but it does indeed work. Maybe it was after I'd removed annd re-added the plugin and platform a few times.
I think I was able to fix this by adding the following to my config:
<preference name="GradlePluginKotlinEnabled" value="true" /> <preference name="GradlePluginKotlinVersion" value="1.7.10" />
My build succeeds at least. No idea why this just started happening. Everything was fine a day or two ago.
Ah I thought i was going crazy! My builds were working fine 2 weeks ago, changed nothing & wasn't working today :(. Spent all day looking for a fix until I came across @preziotte's solution. Fixed it for me! Thank you!
Thank you @preziotte! This kind of things are pushing me to migrate everything to capacitor 😓
@matscav what's capacitor?
Me either had the same problem. Trying to fix it, I deleted ~/.gradle/caches
, then deleted entire ~/.gradle
. Nothing helped: my assembly chain creates the cordova project from scratch each build; I have the recent Java SDK.
Indeed, my build chain worked two weeks ago, and now it's broken without any changes from my side. Nevertheless, the solution of @preziotte (thank you, mate !) worked to me. I'm curious what happened...
The output of my build toolchain is the following (after clean launch) :
Task :app:compileDebugKotlin FAILED
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
/Users/xxx/.gradle/caches/transforms-3/37c16254af6de93c45d2587b8dfcd992/transformed/jetified-kotlin-stdlib-jdk7-1.5.20.jar (version 1.5)
/Users/xxx/.gradle/caches/transforms-3/16f0fa7a8f147bbbdd08181b1d0ed2ab/transformed/jetified-kotlin-stdlib-1.7.10.jar (version 1.7)
/Users/xxx/.gradle/caches/transforms-3/727d189c560aae87eb38bbb136e543d5/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: /Users/xxx/.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: /Users/xxx/.gradle/caches/transforms-3/16f0fa7a8f147bbbdd08181b1d0ed2ab/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: /Users/xxx/.gradle/caches/transforms-3/727d189c560aae87eb38bbb136e543d5/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: /Users/xxx/work/prescrire/guide/cordova/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 /Users/xxx/.gradle/caches/transforms-3/16f0fa7a8f147bbbdd08181b1d0ed2ab/transformed/jetified-kotlin-stdlib-1.7.10.jar!/kotlin/Suppress.class
e: /Users/xxx/work/prescrire/guide/cordova/platforms/android/app/src/main/java/com/adobe/phonegap/push/BackgroundActionButtonHandler.kt: (31, 25): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
ref: #224
@matscav what's capacitor?
I had the same error appear on me out of nowhere and I literally spent almost 2 days trying to figure it out. I even switched to MacOS for building thinking it's a Windows issue but it was exactly the same. Everything worked and suddenly stopped.
My app builds now after adding the preference, however on MacOS I encountered the problem somewhere else, but thankfully it doesn't cause the build to fail:
e: /Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.7.10/d2abf9e77736acc4450dc4a3f707fa2c10f5099d/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.4.0.
e: /Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.7.10/1ef73fee66f45d52c67e2aca12fd945dbe0659bf/kotlin-stdlib-jdk7-1.7.10.jar!/META-INF/kotlin-stdlib-jdk7.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.4.0.
e: /Users/user/.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.4.0.
e: /Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-android-extensions-runtime/1.7.10/6cf8c7aec5501d2892bc4392f0a109f68eb86da/kotlin-android-extensions-runtime-1.7.10.jar!/META-INF/kotlin-android-extensions-runtime.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.4.0.
e: /Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.10/bac80c520d0a9e3f3673bc2658c6ed02ef45a76a/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.4.0.
Why did it fail in the first place if nothing has changed in the project? Even my cordova gradle config uses Kotlin 1.5.20 and somehow suddenly things stopped working?
@veodko : it might be this problem #224
@veodko : it might be this problem #224
I have already tried the modified version of the plugin, as well as adding the Kotlin version preference to cordova.
This error is thrown from task:lintVitalRelease
and does not affect the build, I guess it's not a crucial task but I'm still a little concerned.
It complains about version 1.4.0 here so it's something that uses an even older version than the rest of Cordova.
This whole problem kinda looks like something just started ignoring older Kotlin versions and builds with 1.7.1 anyway. It's weird because during the cordova build I could see that kotlin compiler for 1.5.20 was being downloaded. I thought that using the modified plugin & removing the preference would fix it (if the plugin was only one at fault) but it's still there.
Just a bump for "capacitor". I maintain bunch of hybrid apps. About 50% on capacitor and 50% are still on cordova. The capacitor ones are a dream to maintain with zero issues, whereas every time I make a change on a cordova app, hours are wasted on issues just like this.
Just a bump for "capacitor". I maintain bunch of hybrid apps. About 50% on capacitor and 50% are still on cordova. The capacitor ones are a dream to maintain with zero issues, whereas every time I make a change on a cordova app, hours are wasted on issues just like this.
It's true, cordova is a total mess with every single plugin not being maintained by anyone for 2-4 years and even if people try to maintain them by making PRs, no one accepts them so we end up with 10 forks of the same plugin. I'm only still using this garbage technology because of a large app written using cordova and meteorjs. There is no time to move this to anything newer, it would require a full rewrite to some other framework.
I think I was able to fix this by adding the following to my config:
<preference name="GradlePluginKotlinEnabled" value="true" /> <preference name="GradlePluginKotlinVersion" value="1.7.10" />
My build succeeds at least. No idea why this just started happening. Everything was fine a day or two ago.
I am upgrading an old project from cordova-android@10.x.x to cordova-android@11.x.x.
The build did not succeed in my project after this change. however, error regarding JAR Files disappeared.
@preziotte thanks for your suggestion as above. I've applied your suggestion but it does not fix the build yet.
Given, I am using Node - v18.15.0, NPM-v9.5.0, cordova-v11, cordova-android-v11, gulp-v3.9, android-sdk-build-tools-v32.0.0,
Please suggest:
> Task :app:compileReleaseKotlin
e: /path-to-my-app/platforms/android/app/src/main/java/com/adobe/phonegap/push/PushPlugin.kt: (466, 57): Unresolved reference: token
e: /path-to-my-app/platforms/android/app/src/main/java/com/adobe/phonegap/push/PushPlugin.kt: (619, 57): Unresolved reference: deleteToken
Just a bump for "capacitor". I maintain bunch of hybrid apps. About 50% on capacitor and 50% are still on cordova. The capacitor ones are a dream to maintain with zero issues, whereas every time I make a change on a cordova app, hours are wasted on issues just like this.
It's true, cordova is a total mess with every single plugin not being maintained by anyone for 2-4 years and even if people try to maintain them by making PRs, no one accepts them so we end up with 10 forks of the same plugin. I'm only still using this garbage technology because of a large app written using cordova and meteorjs. There is no time to move this to anything newer, it would require a full rewrite to some other framework.
Thats why we should keep the community alive, and going, so we dont have to spend huge amount of time for rewrite.... Selfishly atleast keep the community going until our retirement lol
Just a bump for "capacitor". I maintain bunch of hybrid apps. About 50% on capacitor and 50% are still on cordova. The capacitor ones are a dream to maintain with zero issues, whereas every time I make a change on a cordova app, hours are wasted on issues just like this.
Want to maintain one more? We are looking to outsource the maintenance of our Cordova app.
It's true, cordova is a total mess with every single plugin not being maintained by anyone for 2-4 years and even if people try to maintain them by making PRs, no one accepts them so we end up with 10 forks of the same plugin.
Thats why we should keep the community alive
@clarklight, that's exactly what the person before you said - people TRY to keep the community alive, but more and more companies are stopping with hybrid apps exactly because they're messy and the Cordova maintainers can't even keep a push plugin alive. This isn't even an official plugin, and unofficial plugins tend to do exactly this: get ghosted and fall out of maintenance. And then, people completely unrelated start showing up with issues and try to jerry-rig solutions (I even have my own fork of this, trying to fix #94 from more than 2 years ago), until someone more knowledgeable tries to steer the ship back to its course. Sadly, it's very rare for a new captain to show up, or the old one to wake up. Bottom-line: the community is alive, but without captains to take control of the ships, we'll slowly drown. So we better jump ship before it's too late - and I feel it is, since there are years this essential plugin is taking dust around here...
@preziotte thanks for your suggestion as above. I've applied your suggestion but it does not fix the build yet.
Given, I am using Node - v18.15.0, NPM-v9.5.0, cordova-v11, cordova-android-v11, gulp-v3.9, android-sdk-build-tools-v32.0.0,
Please suggest:
> Task :app:compileReleaseKotlin e: /path-to-my-app/platforms/android/app/src/main/java/com/adobe/phonegap/push/PushPlugin.kt: (466, 57): Unresolved reference: token e: /path-to-my-app/platforms/android/app/src/main/java/com/adobe/phonegap/push/PushPlugin.kt: (619, 57): Unresolved reference: deleteToken
Make sure you do not only upgrade the push plugin to the latest version 4.0.0-dev.0 but either first uninstall the plugin with:
cordova plugin remove @havesource/cordova-plugin-push
and then reinstall with:
cordova plugin add @havesource/cordova-plugin-push@dev
Or manually update the versions under cordova.plugins
in package.json
to the following:
"@havesource/cordova-plugin-push": {
"ANDROIDX_CORE_VERSION": "1.6.+",
"FCM_VERSION": "23.+",
"IOS_FIREBASE_MESSAGING_VERSION": "~> 8.1.1"
}
Finally, you also need to make sure the POST_NOTIFICATIONS
permission is present in config.xml
:
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
Until #238 has been fixed you can use cordova-plugin-android-permissions to check for and request permissions.
Bug Report
It is not possible to build the application for android platform sdk 31 and 32 after adding the plugin.
Platform and Version: Android Sdk 31 and 32
cordova info
Printout