I've tried to update my Android project to Kotlin 1.4.0
, since it's now oficially stable, and after update I've encountered a problem. I will not post the entire stack here, since it's very long, but the mot top part of it looks like this:
...
> Task :app:transformClassesWithFirebasePerformancePluginForDebug
java.lang.ClassNotFoundException: javax.mail.internet.MimeBodyPart
> Task :app:mergeDebugJavaResource
> Task :app:dexBuilderDebug FAILED
org.gradle.workers.WorkerExecutionException: There was a failure while executing work items
...
Looking for a cause, lower in the stack, I've found this:
...
Caused by: org.gradle.tooling.BuildException: Failed to process:
/bitrise/src/app/build/intermediates/transforms/FirebasePerformancePlugin/debug/0,
/bitrise/src/app/build/intermediates/transforms/FirebasePerformancePlugin/debug/1,
/bitrise/src/app/build/intermediates/transforms/FirebasePerformancePlugin/debug/2
...
Which directs me to the conclusion, that Firebase Performance library cannot be build correctly. I'm using Firebase Performance version 19.0.8
with gradle classpath plugin version 1.3.1
. I have not changed it for a while, and reverting to earlier versions does not resolve the issue. The last error registered on stack is this:
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
at com.android.builder.dexing.D8DexArchiveBuilder.getExceptionToRethrow(D8DexArchiveBuilder.java:151)
at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:118)
at com.android.build.gradle.internal.dexing.DexWorkActionKt.process(DexWorkAction.kt:194)
... 33 more
Caused by: java.lang.IllegalStateException: Unexpected non-class file: META-INF/versions/9/kotlin/reflect/jvm/internal/impl/serialization/deserialization/builtins/BuiltInsResourceLoader.class
I've determined, that removing Firebase Performance library and reverting back to Kotlin 1.3.71
resolves the problem, but I'd like to keep them both for future of the project, so I'm looking for other solution.
My build.gradle
file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'
apply plugin: 'androidx.navigation.safeargs.kotlin'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.firebase.firebase-perf'
apply from: "dependencies.gradle"
apply from: "buildtypes.gradle"
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.app"
minSdkVersion 23
targetSdkVersion 29
versionCode 100
versionName "1.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
archivesBaseName = "$applicationId-$versionName-$versionCode"
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
buildFeatures {
dataBinding = true
}
}
And a complete list of dependencies:
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$versions.coreDesugaring"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "androidx.core:core:$versions.core"
implementation "androidx.core:core-ktx:$versions.core"
implementation "androidx.appcompat:appcompat:$versions.appCompat"
implementation "androidx.browser:browser:$versions.browser"
implementation "androidx.constraintlayout:constraintlayout:$versions.constraintLayout"
implementation "androidx.legacy:legacy-support-v4:$versions.legacy"
// UI
implementation "com.google.android.material:material:$versions.material"
implementation "com.appyvet:materialrangebar:$versions.materialRangeBar"
implementation "com.wdullaer:materialdatetimepicker:$versions.datetimepicker"
// Lifecycle
implementation "androidx.lifecycle:lifecycle-extensions:$versions.lifecycle"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$versions.lifecycle"
// Navigation component
implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"
// Coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$versions.coroutines"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$versions.coroutines"
// Koin
implementation "org.koin:koin-android:$versions.koin"
implementation "org.koin:koin-androidx-ext:$versions.koin"
implementation "org.koin:koin-androidx-scope:$versions.koin"
implementation "org.koin:koin-androidx-viewmodel:$versions.koin"
// Work Manager
implementation "androidx.work:work-runtime:$versions.work"
implementation "androidx.work:work-runtime-ktx:$versions.work"
// Flipper
debugImplementation "com.facebook.soloader:soloader:$versions.soloader"
debugImplementation "com.facebook.flipper:flipper-network-plugin:$versions.flipper"
debugImplementation "com.kgurgul.flipper:flipper-realm-android:$versions.flipperRealm"
debugImplementation "com.facebook.flipper:flipper:$versions.flipper"
releaseImplementation "com.facebook.flipper:flipper-noop:$versions.flipper"
// Location & Maps
implementation "com.google.android.gms:play-services-maps:$versions.playLocation"
implementation "com.google.android.gms:play-services-location:$versions.playLocation"
implementation "com.google.maps.android:android-maps-utils:$versions.mapUtils"
// Logging
implementation "com.jakewharton.timber:timber:$versions.timber"
implementation "org.slf4j:slf4j-api:$versions.slf4j"
implementation "com.github.tony19:logback-android:$versions.logback"
// Databases
implementation "com.github.sevar83:android-spatialite:$versions.spatialite"
// Archives
implementation "org.zeroturnaround:zt-zip:$versions.ztZip"
// Dialogs
implementation "com.afollestad.material-dialogs:core:$versions.materialDialogs"
implementation "com.afollestad.material-dialogs:datetime:$versions.materialDialogs"
implementation "com.afollestad.material-dialogs:lifecycle:$versions.materialDialogs"
// Permissions
implementation "com.karumi:dexter:$versions.dexter"
implementation("dev.doubledot.doki:library:$versions.doki") {
transitive = true
}
// JSON
implementation "com.squareup.moshi:moshi:$versions.moshi"
implementation "com.squareup.moshi:moshi-kotlin:$versions.moshi"
// Firebase
implementation "com.google.firebase:firebase-analytics:$firebase_versions.analytics"
implementation "com.google.firebase:firebase-crashlytics:$firebase_versions.crashlytics"
implementation "com.google.firebase:firebase-perf:$firebase_versions.performance"
// Payments
implementation "com.android.billingclient:billing:$versions.billing"
implementation "com.android.billingclient:billing-ktx:$versions.billing"
// Testing
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
testImplementation "junit:junit:$test_version.junit"
testImplementation "androidx.test:core:$test_version.androidTest"
testImplementation "androidx.test:runner:$test_version.androidTest"
Why is this build failing? Is it Kotlin's 1.4.0
fault, or is there something wrong with dependencies? Can this issue be solved without reverting to previous Kotlin version?
1.3.72
then? – Aldrich1.3.72
everything works fine. I've done clean rebuilds, and nothing seems to help. – Energumen