The app crashes anytime I interact with just about any compose control. Just the release, the debug works fine. The error says: androidx.compose.ui.R$id is missing hide_in_inspector_tag
The stacktrace is below.
This definitely some sort of R8 issue. I've been adding things to proguard config and got to the point you at least seeing the class and field names, but so far I can't get to keep the field.
I didn't have this problem on a release done a week ago. I updated the Android Studio to Android Studio Iguana | 2023.2.1 Patch 1
with:
gradleplugin = "8.3.1"
gradleAndroidCommandPlugin = "1.6.2"
I feel like I must have some version mismatch, but I can't seem to find one.
I tried the following in proguard without luck:
-keep class androidx.compose.ui.R$id { *; }
-keepclassmembers class androidx.compose.ui.R$id {
<init>(...);
<fields>;
}
-keep class androidx.compose.ui.R$id {
public static <fields>;
}
-keep class androidx.compose.ui.R$id {
static int hide_in_inspector_tag;
}
E java.lang.NoSuchFieldError: No static field hide_in_inspector_tag of type I in class Landroidx/compose/ui/R$id; or its superclasses (declaration of 'androidx.compose.ui.R$id' appears ....ExHFPZftc_jp0b694EN84A==/base.apk)
E at androidx.compose.material.ripple.RippleContainer.<init>(SourceFile:49)
E at androidx.compose.material.ripple.AndroidRippleIndicationInstance.getOrCreateRippleContainer(SourceFile:48)
E at androidx.compose.material.ripple.AndroidRippleIndicationInstance.addRipple(SourceFile:1)
E at androidx.compose.material.ripple.Ripple$rememberUpdatedInstance$1$1.emit(SourceFile:2)
E at androidx.compose.material.ripple.Ripple$rememberUpdatedInstance$1$1.emit(SourceFile:1)
E at z7.F.B(SourceFile:214)
E at z7.F$c.invokeSuspend(SourceFile:13)
E at kotlin.coroutines.jvm.internal.a.resumeWith(SourceFile:12)
E at w7.W.run(SourceFile:129)
E at androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch(SourceFile:7)
E at androidx.compose.ui.platform.AndroidUiDispatcher.access$performTrampolineDispatch(SourceFile:1)
E at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.run(SourceFile:3)
E at android.os.Handler.handleCallback(Handler.java:938)
E at android.os.Handler.dispatchMessage(Handler.java:99)
E at android.os.Looper.loopOnce(Looper.java:201)
E at android.os.Looper.loop(Looper.java:288)
E at android.app.ActivityThread.main(ActivityThread.java:7839)
E at java.lang.reflect.Method.invoke(Native Method)
E at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
E Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.ui.platform.MotionDurationScaleImpl@9784809, androidx.compose.runtime.h@e1f9a0e, N0{Cancelling}@9390c2f, Androi```
I created a test project, it worked fine. So I started to try to narrow down the difference. I update the test project to same version of the Compose BOM, kotlin, and build tools. The same, still works fine. Put the same compose dependencies in my project that the test was using. Mine still crashes. Test still works. My app use a compose glide library, take that out. Nothing changes. I just add a view using:
androidx-adaptive = { module = "androidx.compose.material3.adaptive:adaptive", version.ref = "adaptive" }
androidx-adaptive-layout = { module = "androidx.compose.material3.adaptive:adaptive-layout", version.ref = "adaptive" }
androidx-adaptive-navigation = { module = "androidx.compose.material3.adaptive:adaptive-navigation", version.ref = "adaptive" }
This an adaptive view to handle list details screens on narrow and wide screens.
So paste those dependencies into the test project. Boom! The test project crashes (It's not even using, it's just including it). So I guess I'm ripping out the view a spend a few days writing. And I guess I should file a bug. The adaptive stuff is alpha, so...
I can add the first dependency, on adding the second dependency, the crashes start.