I get the following error in an Android-App-Project in AndroidStudio:
java.lang.VerifyError: Verifier rejected class CLASSNAME: void CLASSNAME.FKTNAME(ARGS) failed to verify: void CLASSNAME.FKTNAME(ARGS): [0xBEEF] copy1 vXX <-vYY type=Imprecise Constant: 127 cat=3
This question is similar to my error, except for the exact situation and that I get it in debug-build, which has isMinifyEnabled = false
and pro-guard is only applied to release-build.
The error happens in the context of androidx.compose.
The original error
I already got a similar error before (a different code section, the same function and obviously different registers), that I was able to solve by putting LocalContext.current
(just this, no assignment or similar) at the beginning of the box that contained the Column whose modifier contained the problematic code section.
The error came as the box was added to surround the Column. One of the candidates for causing the issue was this code section:
val isLandscape
@Composable
@ReadOnlyComposable
get() = LocalConfiguration.current.orientation == Configuration.ORIENTATION_LANDSCAPE
If the value of get
-function was replaced by true
or false
, the error would not be there (if all other problematic code was removed/commented).
The new error
I analysed the changes of the commit that introduced the issue. It looked like a very similar problem.
The main part of the problem is related to a function call. This made it nessesary to extract the section to a function, as I was not able to create dummy values for all required arguments (as this was part of the diagnosis of the old problem) and this way I can just disable the call to the original function inside of the new function and decide what arguments I want to test.
This way I was able to find “one-line breaking changes”. One example is putting or not putting the first problematic argument to the new function. This argument is passed to the top-level function (the one mentioned in the error log), is it is not changed (in obvious ways) inside of it. This might also be the reason why this time I was not able to get around it by a similar trick as the old error.
The original error message (before I extracted the function) contains this
[0x56A0] copy1 v6<-v69 type=Imprecise Constant: 127 cat=3
The following I created based on the smali-code that is generated for the function and it contains some relevant lines of the decompiled smali-code.
166: .param p0, "navController" # Landroidx/navigation/NavController;
170: p4, "shape" # Landroidx/compose/foundation/shape/RoundedCornerShape;
172: param p6, "$composer" # Landroidx/compose/runtime/Composer;
221: v1, p6
249: v68, v1
259: v68, p3
263: .local v68, "modifier":Landroidx/compose/ui/Modifier;
318: .local v1, "shape":Landroidx/compose/foundation/shape/RoundedCornerShape;
325: v69, v1 # "shape"
333: v69, p4
341: .local v69, "shape":Landroidx/compose/foundation/shape/RoundedCornerShape
1075: p4, v11 # not important
1077: .local p4, "$this$cache$iv":Landroidx/compose/runtime/Composer;
3505: v6, v69
9074: v69, 0x6
31302: .end local v6
31535: sget-object v6, Landroidx/compose/runtime/Composer;->Companion:Landroidx/compose/runtime/Composer$Companion;
31547: v6, v4
31554: v6, 0x0 # null?
31557: .local v6, "$i$a$-cache-PlayerModernKt$PlayerModern$30$5":I
31565: .end local v6
31566: v6, v7
31569: .local v6, "value$iv":Ljava/lang/Object;
31576: .end local v6 # "value$iv":Ljava/lang/Object;
31744: sget-object v6, Landroidx/compose/runtime/Composer;->Companion:Landroidx/compose/runtime/Composer$Companion;
31765: v6, 0x0 # null?
31769: .local v6, "$i$a$-cache-PlayerModernKt$PlayerModern$30$8":I
31780: .end local v6 # "$i$a$-cache-PlayerModernKt$PlayerModern$30$8":I
31988: v6, v69
32271: v6, v69
32488: v10, Lcom/example/app/ui/screens/player/PlayerModernKt$PlayerModern$1;
32490: v1, v10 # PlayerModern$1
32492: v2, p0 # "navController"
32494: v3, p1 # "layoutState"
32496: v4, p2 # "playerState"
32498: v5, v68 # "modifier"
32500: v6, v69 # should be Landroidx/compose/foundation/shape/RoundedCornerShape
32502: v7, p5 # "onDismiss" # Lkotlin/jvm/functions/Function0;
32504: v8, p7 # "$composer" # Landroidx/compose/runtime/Composer;
32506: v9, p8 # ?
I guess that the error is about line 32500
.
In general compose
-related issues seem like a very difficult thing to debug.
Can someone please explain why this old error was fixed via this way and what I can do about the new error?