plugins: [@nativescript/geolocation] unable to compile Android version as I get a `Execution failed for task ':app:checkDebugDuplicateClasses'.`
Hi,
I’ve been using this in a project and now I am unable to compile this same project for Android. I’ve tried creating a brand new project to identify the problem and it seems to be linked to this dependency as as soon as I add it I get the following error while running tns run android
:
Execution failed for task ':app:checkDebugDuplicateClasses'.
Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules jetified-kotlin-stdlib-1.9.0 (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations found in modules jetified-kotlin-stdlib-1.9.0 (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) and jetified-kotlin-stdlib-jdk7-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0)
Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations found in modules jetified-kotlin-stdlib-1.9.0 (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.io.path.ExperimentalPathApi found in modules jetified-kotlin-stdlib-1.9.0 (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) and jetified-kotlin-stdlib-jdk7-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0)
Duplicate class kotlin.io.path.PathRelativizer found in modules jetified-kotlin-stdlib-1.9.0 (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) and jetified-kotlin-stdlib-jdk7-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0)
Duplicate class kotlin.io.path.PathsKt found in modules jetified-kotlin-stdlib-1.9.0 (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) and jetified-kotlin-stdlib-jdk7-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0)
Duplicate class kotlin.io.path.PathsKt__PathReadWriteKt found in modules jetified-kotlin-stdlib-1.9.0 (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) and jetified-kotlin-stdlib-jdk7-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0)
Duplicate class kotlin.io.path.PathsKt__PathUtilsKt found in modules jetified-kotlin-stdlib-1.9.0 (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) and jetified-kotlin-stdlib-jdk7-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0)
Duplicate class kotlin.jdk7.AutoCloseableKt found in modules jetified-kotlin-stdlib-1.9.0 (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) and jetified-kotlin-stdlib-jdk7-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0)
Duplicate class kotlin.jvm.jdk8.JvmRepeatableKt found in modules jetified-kotlin-stdlib-1.9.0 (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.random.jdk8.PlatformThreadLocalRandom found in modules jetified-kotlin-stdlib-1.9.0 (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.streams.jdk8.StreamsKt found in modules jetified-kotlin-stdlib-1.9.0 (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$1 found in modules jetified-kotlin-stdlib-1.9.0 (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$2 found in modules jetified-kotlin-stdlib-1.9.0 (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$3 found in modules jetified-kotlin-stdlib-1.9.0 (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$4 found in modules jetified-kotlin-stdlib-1.9.0 (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.text.jdk8.RegexExtensionsJDK8Kt found in modules jetified-kotlin-stdlib-1.9.0 (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Duplicate class kotlin.time.jdk8.DurationConversionsJDK8Kt found in modules jetified-kotlin-stdlib-1.9.0 (org.jetbrains.kotlin:kotlin-stdlib:1.9.0) and jetified-kotlin-stdlib-jdk8-1.6.0 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0)
Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
The package.json
file of my empty project for more details:
{
"name": "NSEmptyProject",
"main": "app/app.js",
"version": "1.0.0",
"private": true,
"dependencies": {
"@nativescript/core": "~8.6.2",
"@nativescript/theme": "~3.0.2",
"nativescript-vue": "~2.9.3",
"@finanzritter/nativescript-share-file": "^2.0.1",
"@nativescript-community/sentry": "^4.6.12",
"@nativescript-community/ui-canvas": "^4.0.50",
"@nativescript-community/ui-collectionview": "^4.0.29",
"@nativescript-community/ui-image": "4.3.6",
"@nativescript-community/ui-material-bottom-navigation": "^7.0.24",
"@nativescript-community/ui-material-core": "^7.0.24",
"@nativescript-community/ui-material-tabs": "^7.0.24",
"@nativescript-community/ui-pager": "^13.0.2",
"@nativescript-community/ui-pulltorefresh": "^2.5.3",
"@nativescript-community/ui-webview": "^1.4.4",
"@nativescript-community/universal-links": "^2.0.7",
"@nativescript/camera": "^5.0.15",
"@nativescript/email": "^2.0.5",
"@nativescript/imagepicker": "^1.0.9",
"@nativescript/localize": "^5.0.2",
"@nativescript/social-share": "^2.0.1",
"buffer": "^6.0.3",
"moment": "^2.29.0",
"nativescript-barcodescanner": "^4.1.2",
"nativescript-imagecropper": "^4.0.1",
"nativescript-phone": "^2.0.0",
"nativescript-plugin-universal-links": "^2.0.0",
"nativescript-ui-calendar": "^7.0.2",
"nativescript-ui-chart": "^8.0.2",
"nativescript-ui-listview": "^9.1.0",
"nativescript-vue-multi-drawer": "^0.0.4",
"nativescript-websockets": "^1.5.6",
"vue": "^2.6.12",
"vue-template-compiler": "^2.6.12",
"vuelidate": "^0.7.6",
"vuex": "^3.5.1",
"@nativescript/geolocation": "^8.3.1"
},
"devDependencies": {
"@nativescript/android": "8.5.0",
"@nativescript/webpack": "~5.0.18",
"nativescript-vue-template-compiler": "~2.9.3"
}
}
I might have missed something and would highly appreciate any help on this subject.
About this issue
- Original URL
- State: open
- Created 5 months ago
- Comments: 17 (5 by maintainers)
This looks like a kotlin version conflict thing. You can do the following steps to solve this.
useKotlin
configurationFor these, you will need two new gradle files in App_Resources/Android as described here: https://docs.nativescript.org/guide/native-code/android#enable-kotlin
@CatchABus created app from scratch, added link to library @nativescript/geolocation, made all changes described in the link: https://docs.nativescript.org/guide/native-code/android#enable-kotlin
Building release version of the app
ns build android --bundle --release --key-store-path "path" --key-store-password pwd --key-store-alias alias --key-store-alias-password password --env.uglify --env.aot
produces such logs, but .apk file created:
e: /Users/user/.gradle/caches/transforms-3/87784638ab761edd0eee6786a12d37af/transformed/jetified-play-services-location-21.1.0/jars/classes.jar!/META-INF/third_party.kotlin.kotlinx_coroutines.google.java.kotlinx.coroutines.google_context_interceptor.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. e: /Users/user/.gradle/caches/transforms-3/87784638ab761edd0eee6786a12d37af/transformed/jetified-play-services-location-21.1.0/jars/classes.jar!/META-INF/java.com.google.android.gms.libs.identity_identity.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. e: /Users/user/.gradle/caches/transforms-3/87784638ab761edd0eee6786a12d37af/transformed/jetified-play-services-location-21.1.0/jars/classes.jar!/META-INF/third_party.kotlin.kotlinx_atomicfu_kotlinx_atomicfu-jvm.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. e: /Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-parcelize-runtime/1.9.10/413be2a8afc215889d5a1698466bc034edfcc7b6/kotlin-parcelize-runtime-1.9.10.jar!/META-INF/parcelize-runtime.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. e: /Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-android-extensions-runtime/1.9.10/f389651eb00395324af2c2011d7c171a160073a3/kotlin-android-extensions-runtime-1.9.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.9.0, expected version is 1.7.1. e: /Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.9.10/72812e8a368917ab5c0a5081b56915ffdfec93b7/kotlin-stdlib-1.9.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.9.0, expected version is 1.7.1. e: /Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.9.10/72812e8a368917ab5c0a5081b56915ffdfec93b7/kotlin-stdlib-1.9.10.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. e: /Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.9.10/72812e8a368917ab5c0a5081b56915ffdfec93b7/kotlin-stdlib-1.9.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.9.0, expected version is 1.7.1. e: /Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.9.10/dafaf2c27f27c09220cee312df10917d9a5d97ce/kotlin-stdlib-common-1.9.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.9.0, expected version is 1.7.1.
Last version that works without problems and other actions is 21.0.1:
project.ext { googlePlayServicesVersion = "21.0.1" }
@CatchABus if i would do anything wrong, my debug run would not be ok. That logs (above) are appearing only for release build.
And I assume that the best recommendation for now is to use 21.0.1 version of the googlePlayServicesVersion in project.ext values.
Lovely!
I added those two respectively and it worked like a charm! Thanks
Hello, I solved this by downgrading
NS_DEFAULT_ANDROID_BUILD_TOOLS_VERSION
toNS_DEFAULT_ANDROID_BUILD_TOOLS_VERSION=7.3.0
in my gradle.properties