The application works stably on tested emulators in the studio and real devices. When uploading to the Internal Testing section in Google Play, the device consistently crashes:
Google Pixel 6 1080x2400 Android 12 (SDK 31) 8,192 MB arm64-v8a.
Google Play Console stacktrace
Exception java.lang.NoSuchFieldError: No field Key of type Lkotlinx/coroutines/CoroutineExceptionHandler$Key; in class Lkotlinx/coroutines/CoroutineExceptionHandler; or its superclasses (declaration of 'kotlinx.coroutines.CoroutineExceptionHandler' appears in /data/app/~~KWhmPpaU6JtpmIAZBH3isw==/androidx.test.tools.crawler-P3SH8J3nls-tHnM5nwslZg==/base.apk)
at ua.at.tsvetkov.weather.ui.outfits.quick.QuickSelectionViewModel.<init> (QuickSelectionViewModel.kt:235)
at ua.at.tsvetkov.weather.DaggerAppWeather_HiltComponents_SingletonC$ViewModelCImpl$SwitchingProvider.get (DaggerAppWeather_HiltComponents_SingletonC.java:644)
at dagger.hilt.android.internal.lifecycle.HiltViewModelFactory$2.createViewModel (HiltViewModelFactory.java:133)
at dagger.hilt.android.internal.lifecycle.HiltViewModelFactory$2.create (HiltViewModelFactory.java:104)
at dagger.hilt.android.internal.lifecycle.HiltViewModelFactory.create (HiltViewModelFactory.java:171)
at androidx.lifecycle.ViewModelProvider.get (ViewModelProvider.kt:184)
at androidx.lifecycle.ViewModelProvider.get (ViewModelProvider.kt:150)
at androidx.lifecycle.ViewModelLazy.getValue (ViewModelLazy.kt:53)
at androidx.lifecycle.ViewModelLazy.getValue (ViewModelLazy.kt:35)
at ua.at.tsvetkov.weather.ui.outfits.quick.QuickSelectionFragment.getViewModel (QuickSelectionFragment.kt:55)
at ua.at.tsvetkov.weather.ui.outfits.quick.QuickSelectionFragment.onCreateView (QuickSelectionFragment.kt:62)
at androidx.fragment.app.Fragment.performCreateView (Fragment.java:3114)
at androidx.fragment.app.FragmentStateManager.createView (FragmentStateManager.java:557)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState (FragmentStateManager.java:272)
at androidx.fragment.app.FragmentStore.moveToExpectedState (FragmentStore.java:114)
at androidx.fragment.app.FragmentManager.moveToState (FragmentManager.java:1455)
at androidx.fragment.app.FragmentManager.dispatchStateChange (FragmentManager.java:3034)
at androidx.fragment.app.FragmentManager.dispatchViewCreated (FragmentManager.java:2945)
at androidx.fragment.app.Fragment.performViewCreated (Fragment.java:3148)
at androidx.fragment.app.FragmentStateManager.ensureInflatedView (FragmentStateManager.java:410)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState (FragmentStateManager.java:271)
at androidx.fragment.app.FragmentLayoutInflaterFactory.onCreateView (FragmentLayoutInflaterFactory.java:142)
at androidx.fragment.app.FragmentController.onCreateView (FragmentController.java:136)
at androidx.fragment.app.FragmentActivity.dispatchFragmentsOnCreateView (FragmentActivity.java:247)
at androidx.fragment.app.FragmentActivity.onCreateView (FragmentActivity.java:226)
at android.view.LayoutInflater.tryCreateView (LayoutInflater.java:1073)
at android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:1001)
at android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:965)
at android.view.LayoutInflater.rInflate (LayoutInflater.java:1127)
at android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:1088)
at android.view.LayoutInflater.parseInclude (LayoutInflater.java:1267)
at android.view.LayoutInflater.rInflate (LayoutInflater.java:1123)
at android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:1088)
at android.view.LayoutInflater.parseInclude (LayoutInflater.java:1267)
at android.view.LayoutInflater.rInflate (LayoutInflater.java:1123)
at android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:1088)
at android.view.LayoutInflater.inflate (LayoutInflater.java:686)
at android.view.LayoutInflater.inflate (LayoutInflater.java:538)
at ua.at.tsvetkov.weather.databinding.ActivityMainBinding.inflate (ActivityMainBinding.java:53)
at ua.at.tsvetkov.weather.databinding.ActivityMainBinding.inflate (ActivityMainBinding.java:47)
at ua.at.tsvetkov.weather.ui.main.MainActivity.onCreate (MainActivity.kt:95)
at android.app.Activity.performCreate (Activity.java:8050)
at android.app.Activity.performCreate (Activity.java:8030)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1329)
at androidx.test.runner.MonitoringInstrumentation.callActivityOnCreate (MonitoringInstrumentation.java:2)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3608)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3792)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2210)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loopOnce (Looper.java:201)
at android.os.Looper.loop (Looper.java:288)
at android.app.ActivityThread.main (ActivityThread.java:7839)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1003)
All libraries were updated to the newest. I tried both the empty proguard-rules.pro file and different options. This latest:
# Kotlinx
-keep interface kotlinx.coroutines.CoroutineExceptionHandler { *; }
-keep class kotlinx.coroutines.android.AndroidExceptionPreHandler
-keep class kotlinx.coroutines.android.AndroidDispatcherFactory
-keep class kotlinx.coroutines.** { *; }
-keepclassmembers class kotlinx.coroutines.* {
<fields>;
<init>();
<methods>;
}
-keep class dagger.hilt.** { *; }
-keepclassmembers class dagger.hilt.* {
<fields>;
<init>();
<methods>;
}
-dontwarn com.google.errorprone.annotations.**
-keepnames @dagger.hilt.android.lifecycle.HiltViewModel class * extends androidx.lifecycle.ViewModel
-keep class kotlinx.coroutines.internal.MainDispatcherFactory { *; }
-keep class kotlinx.coroutines.android.AndroidExceptionPreHandler { *; }
-keep class kotlinx.coroutines.CoroutineExceptionHandler { *; }
-keep class kotlinx.coroutines.android.AndroidDispatcherFactory { *; }
-keep class kotlin.Result { *; }
-keepclassmembernames class kotlinx.** {
volatile <fields>;
}
build.gradle.kts
@file:Suppress("UnstableApiUsage")
import java.io.FileInputStream
import java.io.InputStreamReader
import java.util.Properties
plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-parcelize")
id("kotlin-kapt")
id("com.google.dagger.hilt.android")
id("com.google.gms.google-services")
id("androidx.navigation.safeargs.kotlin")
id("com.google.devtools.ksp")
id("com.google.firebase.crashlytics")
id("androidx.room") version "2.6.1"
}
val skipCommitsCount = 0 // add to verCode if need to align commits count
val verCode = providers.exec {
commandLine("git", "rev-list", "--count", "HEAD")
}.standardOutput.asText.get().trim().toInt()
val gitSha = providers.exec {
commandLine("git", "rev-parse", "--short", "HEAD")
}.standardOutput.asText.get().trim()
val verMajor = 1
val verMinor = 0
val verPatch = 0
val verName = "${verMajor}.${verMinor}.${verPatch}.${verCode}"
val getWeatherApiKey = {
val properties = Properties()
properties.load(project.rootProject.file("local.properties").reader())
properties.getProperty("weather_api_key", "")
}
fun getLocalProperty(key: String, file: String = "local.properties"): Any {
val properties = Properties()
val localProperties = File(file)
if (localProperties.isFile) {
InputStreamReader(FileInputStream(localProperties), Charsets.UTF_8).use { reader ->
properties.load(reader)
}
} else error("File from not found")
return properties.getProperty(key)
}
android {
namespace = "ua.at.tsvetkov.weather"
compileSdk = 34
defaultConfig {
applicationId = "ua.at.tsvetkov.weather"
minSdk = 26
targetSdk = 34
versionCode = verCode
versionName = verName
buildConfigField("String", "GIT_SHA", "\"${gitSha}\"")
buildConfigField("String", "WEATHER_API_KEY", "\"${getLocalProperty("weather_api_key")}\"")
buildConfigField("String", "WEATHER_API_HOST", "\"https://api.weatherapi.com/v1/\"")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
argument("room.schemaLocation", "$projectDir/schemas")
}
}
kapt {
arguments {
arg("room.schemaLocation", "$projectDir/schemas")
}
}
resourceConfigurations.addAll(listOf("en", "ru", "uk"))
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
isDebuggable = false
isShrinkResources = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
viewBinding = true
dataBinding = true
buildConfig = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.2.0"
}
packaging {
resources {
pickFirsts += "META-INF/LICENSE"
pickFirsts += "META-INF/INDEX.LIST"
pickFirsts += "META-INF/DEPENDENCIES"
pickFirsts += "META-INF/*.properties"
pickFirsts += "META-INF/AL2.0"
pickFirsts += "META-INF/LGPL2.1"
pickFirsts += "git.properties"
}
}
}
kapt {
correctErrorTypes = true // Allow references to generated code
}
room {
schemaDirectory(path = "$projectDir/schemas")
}
hilt {
enableAggregatingTask = true
}
dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar", "*.aar"))))
implementation(files("libs/tao-core-1.5.0.aar"))
implementation(files("libs/tao-log-2.1.0.aar"))
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0")
implementation("com.google.firebase:firebase-crashlytics:18.6.2")
implementation("com.google.firebase:firebase-analytics:21.5.1")
val navVersion = "2.7.7"
val liveVersion = "2.7.0"
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.activity:activity-ktx:1.8.2")
implementation("androidx.fragment:fragment-ktx:1.6.2")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:$liveVersion")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$liveVersion")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:$liveVersion")
implementation("androidx.lifecycle:lifecycle-livedata-core-ktx:$liveVersion")
implementation("androidx.navigation:navigation-fragment-ktx:$navVersion")
implementation("androidx.navigation:navigation-ui-ktx:$navVersion")
implementation("androidx.legacy:legacy-support-v4:1.0.0")
implementation("androidx.core:core-splashscreen:1.0.1")
implementation("androidx.annotation:annotation:1.7.1")
implementation("androidx.databinding:databinding-runtime:8.2.2")
implementation("androidx.preference:preference-ktx:1.2.1")
implementation("androidx.cardview:cardview:1.0.0")
implementation("androidx.recyclerview:recyclerview:1.3.2")
implementation("androidx.recyclerview:recyclerview-selection:1.1.0")
implementation("androidx.drawerlayout:drawerlayout:1.2.0")
// Google
implementation("com.google.android.material:material:1.11.0")
implementation("com.google.android.gms:play-services-auth:21.0.0")
implementation("com.google.android.gms:play-services-location:21.1.0")
implementation("com.google.android.play:app-update-ktx:2.1.0")
// implementation("com.google.android.gms:play-services-ads:22.6.0")
// Firebase
val firebaseVersion = "8.0.2"
implementation(platform("com.google.firebase:firebase-bom:32.7.2"))
implementation("com.google.firebase:firebase-analytics-ktx:21.5.1")
// FirebaseUI for Firebase Realtime Database
implementation("com.firebaseui:firebase-ui-database:$firebaseVersion")
// FirebaseUI for Cloud Fire store
implementation("com.firebaseui:firebase-ui-firestore:$firebaseVersion")
// FirebaseUI for Firebase Auth
implementation("com.firebaseui:firebase-ui-auth:$firebaseVersion")
// FirebaseUI for Cloud Storage
implementation("com.firebaseui:firebase-ui-storage:$firebaseVersion")
//Hilt
val hiltVersion ="1.2.0"
implementation("com.google.dagger:hilt-android:2.50")
kapt("com.google.dagger:hilt-compiler:2.50")
implementation("androidx.hilt:hilt-navigation-fragment:$hiltVersion")
implementation("androidx.hilt:hilt-work:$hiltVersion")
implementation("androidx.hilt:hilt-common:$hiltVersion")
kapt("androidx.hilt:hilt-compiler:$hiltVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0")
val workVersion = "2.9.0"
implementation("androidx.work:work-runtime-ktx:$workVersion")
implementation("androidx.work:work-gcm:$workVersion")
//Retrofit
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
// Room
val roomVersion = "2.6.1"
implementation("androidx.room:room-runtime:$roomVersion")
annotationProcessor("androidx.room:room-compiler:$roomVersion")
// To use Kotlin annotation processing tool (kapt)
ksp("androidx.room:room-compiler:$roomVersion")
// Kotlin Extensions and Coroutines support for Room
implementation("androidx.room:room-ktx:$roomVersion")
// Data
implementation("de.siegmar:fastcsv:2.2.2")
implementation("androidx.datastore:datastore-preferences:1.0.0")
// Glide
implementation("com.github.bumptech.glide:glide:4.16.0")
ksp("com.github.bumptech.glide:compiler:4.16.0")
// Lottie
val lottieVersion = "6.3.0"
implementation("com.airbnb.android:lottie:$lottieVersion")
// Circle ImageView
implementation("com.mikhaellopez:circularimageview:4.3.1")
//ml-kit selfie segmentation
implementation("com.google.mlkit:segmentation-selfie:16.0.0-beta4")
implementation("com.google.android.gms:play-services-mlkit-subject-segmentation:16.0.0-beta1")
implementation("com.google.android.gms:play-services-base:18.3.0")
val cameraxVersion = "1.3.1"
implementation("androidx.camera:camera-core:${cameraxVersion}")
implementation("androidx.camera:camera-camera2:${cameraxVersion}")
implementation("androidx.camera:camera-lifecycle:${cameraxVersion}")
implementation("androidx.camera:camera-video:${cameraxVersion}")
implementation("androidx.camera:camera-view:${cameraxVersion}")
implementation("androidx.camera:camera-extensions:${cameraxVersion}")
// Blur
implementation("jp.wasabeef:glide-transformations:4.3.0")
implementation("jp.wasabeef:blurry:4.0.1")
// LeakCanary
// debugImplementation ("com.squareup.leakcanary:leakcanary-android:3.0-alpha-1")
// Testing
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
}
Any suggestions on how to solve this?
03.14.24 Upd. The error appeared again without any changes on my part.