Status Update
Comments
gm...@gmail.com <gm...@gmail.com> #2
Any plans to support this?
gm...@gmail.com <gm...@gmail.com> #3
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.material3:material3-adaptive-navigation-suite:1.4.0-alpha07
androidx.compose.material3:material3-adaptive-navigation-suite-android:1.4.0-alpha07
ze...@google.com <ze...@google.com> #4
Thanks for the report.
Your crash stack as reported externally is:
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.distorted.magic/org.distorted.playui.PlayActivity}: android.view.InflateException: Binary XML file line #12 in org.distorted.magic:layout/play: Binary XML file line #12 in org.distorted.magic:layout/play: Error inflating class org.distorted.playui.PlayView
(...)
Caused by: java.lang.VerifyError: Verifier rejected class org.distorted.library.main.InternalChildrenList: void org.distorted.library.main.InternalChildrenList.addSortingByBuckets(org.distorted.library.main.DistortedNode) failed to verify: void org.distorted.library.main.InternalChildrenList.addSortingByBuckets(org.distorted.library.main.DistortedNode): [0x19] type Undefined unexpected as arg to if-eqz/if-nez (declaration of 'org.distorted.library.main.InternalChildrenList' appears in /data/app/~~3uwbjOmT6qVqIWfcJWDV3g==/org.distorted.magic-awjTiIFTfzpMWKypA3V6hQ==/base.apk!classes4.dex)
Could you share the decompiled code for the class and method listed as unverifiable? Either using dexdump or baksmali?
If you can share artifacts privately then I can provide instructions to make a compiler dump, but from you initial comment that does not sound like it is possible.
ge...@paymentsense.com <ge...@paymentsense.com> #5
ze...@google.com <ze...@google.com> #6
I'm sorry but the trace and logs will not help much in identifying the issue.
To start with I'll need the compiled output of the program. Can you share the full apk? Either attached publicly here or shared privately with
If you cannot share the apk, then I'd ask you to use one of the following tools to decompile the apk locally on your machine and then share the relevant parts of the output.
You can use dexdump which is in the SDK (
You can use
gm...@gmail.com <gm...@gmail.com> #7
ze...@google.com <ze...@google.com> #8
There is one fix on the 8.3 branch you are missing for
You can try and use the latest R8 release on the AGP branch you are using. For AGP 8.3.2 that would be done by amending your build.gradle/kts file with:
pluginManagement {
buildscript {
repositories {
mavenCentral()
maven {
url = uri("https://storage.googleapis.com/r8-releases/raw")
}
}
dependencies {
classpath("com.android.tools:r8:8.3.38") // (edited 3.3.38 to 8.3.38)
}
}
}
sg...@google.com <sg...@google.com> #9
There was a type on the previous comment. Please use classpath("com.android.tools:r8:8.3.38")
.
gm...@gmail.com <gm...@gmail.com> #10
an...@gmail.com <an...@gmail.com> #11
In case it helps at all, I have an open-source project that reproduces this problem. I suspect the root cause is the same as OP's.
The byte code verifier fails with:
2024-04-15 18:12:52.120262 -0400 E/AndroidRuntime( 9925): java.lang.VerifyError: Verifier rejected class com.chiller3.bcr.format.MediaCodecEncoder: void com.chiller3.bcr.format.MediaCodecEncoder.encode(java.nio.ByteBuffer, boolean) failed to verify: void com.chiller3.bcr.format.MediaCodecEncoder.encode(java.nio.ByteBuffer, boolean): [0xCD] type Undefined unexpected as arg to if-eqz/if-nez (declaration of 'com.chiller3.bcr.format.MediaCodecEncoder' appears in /system/priv-app/com.chiller3.bcr/app-release.apk)
2024-04-15 18:12:52.120262 -0400 E/AndroidRuntime( 9925): at com.chiller3.bcr.RecorderThread.recordUntilCancelled(Unknown Source:140)
2024-04-15 18:12:52.120262 -0400 E/AndroidRuntime( 9925): at com.chiller3.bcr.RecorderThread.run(Unknown Source:164)
- baksmali output for that class with AGP 8.1.3:
https://gist.github.com/chenxiaolong/1e26404bb4e9ce27dc0286b80f915a07#file-mediacodecencoder-agp_8_1_3-smali - baksmali output for that class with AGP 8.3.2:
https://gist.github.com/chenxiaolong/1e26404bb4e9ce27dc0286b80f915a07#file-mediacodecencoder-agp_8_3_2-smali
To reproduce locally:
git clone https://github.com/chenxiaolong/BCR -b issue-334275655
cd BCR
./gradlew assembleRelease
# To test with AGP 8.1.3, check out the previous commit: git checkout HEAD~1
# Commit with AGP 8.3.2: HEAD: 5c43cf610ae939a20903bdfed6189b8a2247352d
# Commit with AGP 8.1.3: HEAD~1: f18dff1e9621d75880c3bd87fab16b473ce36e55
an...@gmail.com <an...@gmail.com> #12
Here are the compiler input dumps. Happy to share anything else that could help.
an...@gmail.com <an...@gmail.com> #13
Based on the r8-version
file inside the compiler input dumps, I saw that AGP 8.1.3 uses r8 8.1.68 and AGP 8.3.2 uses r8 8.3.37. I did a git bisect and it looks like there are three distinct behaviors across these commits:
-
The earlier commits (closer to 8.1.68) produce valid byte code.
-
The commits in the middle fail during the build process with the following error:
> Task :app:minifyReleaseWithR8 FAILED ERROR: /home/chenxiaolong/git/github/BCR/app/build/tmp/kotlin-classes/release/com/chiller3/bcr/format/MediaCodecEncoder.class: R8: com.android.tools.r8.errors.CompilationError: Undefined value encountered during compilation. This is typically caused by invalid dex input that uses a register that is not defined on all control-flow paths leading to the use.
The first commit that introduced this behavior is:
https://r8.googlesource.com/r8/+/eb087e165c698f5dd01c1ccfed917494dc1b8ef4%5E%21/ -
The later commits (closer to 8.3.37) succeed during the build, but produce byte code that fails to verify at runtime.
The first commit that introduced this behavior is:
https://r8.googlesource.com/r8/+/c5d7743e1ecd293e317b6ec7a335e33a38a1b88c%5E!/
EDIT: I also gave the latest commit on main
a try (89c6847c96dbe87f0723dd65ce5fe7024b8060f7). The behavior I see there is the same as with AGP 8.3.2 (r8 8.3.37).
ze...@google.com <ze...@google.com> #14
Thanks for the reproduction dumps and for your analysis. It reproduces for me locally and this is indeed an issue all the way up to main. When running with asserts it also hits unexpected paths in the compiler. I'm investigating now and will keep you posted as I figure out more about the issue.
ze...@google.com <ze...@google.com> #15
The assertion error is hitting invalid SSA values. The concrete case is a value not being defined on all control-flow paths to its use. Stack trace is:
Caused by: java.lang.AssertionError: Unexpected values live at entry to first block: [v38]
at com.android.tools.r8.ir.code.IRCode.computeLiveAtEntrySets(IRCode.java:318)
at com.android.tools.r8.ir.regalloc.LinearScanRegisterAllocator.computeLivenessInformation(LinearScanRegisterAllocator.java:654)
at com.android.tools.r8.ir.regalloc.LinearScanRegisterAllocator.allocateRegisters(LinearScanRegisterAllocator.java:226)
at com.android.tools.r8.ir.conversion.IRToDexFinalizer.performRegisterAllocation(IRToDexFinalizer.java:72)
at com.android.tools.r8.ir.conversion.IRToDexFinalizer.finalizeCode(IRToDexFinalizer.java:46)
at com.android.tools.r8.ir.conversion.IRToDexFinalizer.finalizeCode(IRToDexFinalizer.java:23)
at com.android.tools.r8.ir.conversion.LirConverter.finalizeLirMethodToOutputFormat(LirConverter.java:200)
at com.android.tools.r8.ir.conversion.LirConverter.lambda$finalizeLirToOutputFormat$6(LirConverter.java:161)
ze...@google.com <ze...@google.com> #16
The cause of the issue has been found. It is in the R8 SplitBranch optimization where we fail to consider a back-edge may exist.
A fix is progress.
ap...@google.com <ap...@google.com> #17
Branch: main
commit 1885afdeb8c696a8c332cc93f0205afbb731f89b
Author: Ian Zerny <zerny@google.com>
Date: Thu Apr 18 11:03:51 2024
Disable partial rewriting of phis in split branch optimizer
Bug:
Change-Id: I4784cf4059acecef7d3b97afcfbbb8058894e116
M src/main/java/com/android/tools/r8/ir/conversion/passes/SplitBranch.java
ap...@google.com <ap...@google.com> #18
Branch: 8.4
commit 97f743ac1c2fadc9de16b6ede8072f222bc5092d
Author: Ian Zerny <zerny@google.com>
Date: Thu Apr 18 12:42:53 2024
Disable partial rewriting of phis in split branch optimizer
Bug:
Change-Id: I4784cf4059acecef7d3b97afcfbbb8058894e116
M src/main/java/com/android/tools/r8/ir/conversion/passes/SplitBranch.java
ap...@google.com <ap...@google.com> #19
Branch: 8.4
commit d33ed7348b61064a15117dbde1b4f11f5b024013
Author: Ian Zerny <zerny@google.com>
Date: Thu Apr 18 12:43:07 2024
Version 8.4.24
Bug:
Change-Id: Iadd75a802f22d5a858a79fb9a9cc2cc65470dc45
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #20
Branch: 8.3
commit ca15fbe1b2eaed81c9abd18a03b9cfcaa132db64
Author: Ian Zerny <zerny@google.com>
Date: Thu Apr 18 12:44:27 2024
Disable partial rewriting of phis in split branch optimizer
Bug:
Change-Id: I4784cf4059acecef7d3b97afcfbbb8058894e116
M src/main/java/com/android/tools/r8/ir/conversion/passes/SplitBranch.java
ap...@google.com <ap...@google.com> #21
Branch: 8.3
commit 02cbd26118f96e6c6923694ca63a41ce4c21db1a
Author: Ian Zerny <zerny@google.com>
Date: Thu Apr 18 12:44:38 2024
Version 8.3.39
Bug:
Change-Id: Ia00b332a02ccab0cd56dea1183bbe7f4d3ef01db
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #22
Branch: 8.2
commit 50661b5741d93be3913b53b56ea62624420bcf66
Author: Ian Zerny <zerny@google.com>
Date: Thu Apr 18 12:45:38 2024
Version 8.2.53
Bug:
Change-Id: I0c9dcda128a35d674166e6ce084703407d1bad05
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #23
Branch: 8.2
commit 9b8950fefcedb9f72fdd2ae0ab51c34d1a9b9726
Author: Ian Zerny <zerny@google.com>
Date: Thu Apr 18 12:45:21 2024
Disable partial rewriting of phis in split branch optimizer
Bug:
Change-Id: I4784cf4059acecef7d3b97afcfbbb8058894e116
M src/main/java/com/android/tools/r8/ir/conversion/passes/SplitBranch.java
ap...@google.com <ap...@google.com> #24
Branch: 8.4
commit 97f743ac1c2fadc9de16b6ede8072f222bc5092d
Author: Ian Zerny <zerny@google.com>
Date: Thu Apr 18 12:42:53 2024
Disable partial rewriting of phis in split branch optimizer
Bug:
Change-Id: I4784cf4059acecef7d3b97afcfbbb8058894e116
M src/main/java/com/android/tools/r8/ir/conversion/passes/SplitBranch.java
ap...@google.com <ap...@google.com> #25
Branch: 8.3
commit ca15fbe1b2eaed81c9abd18a03b9cfcaa132db64
Author: Ian Zerny <zerny@google.com>
Date: Thu Apr 18 12:44:27 2024
Disable partial rewriting of phis in split branch optimizer
Bug:
Change-Id: I4784cf4059acecef7d3b97afcfbbb8058894e116
M src/main/java/com/android/tools/r8/ir/conversion/passes/SplitBranch.java
ap...@google.com <ap...@google.com> #26
Branch: 8.4
commit 97f743ac1c2fadc9de16b6ede8072f222bc5092d
Author: Ian Zerny <zerny@google.com>
Date: Thu Apr 18 12:42:53 2024
Disable partial rewriting of phis in split branch optimizer
Bug:
Change-Id: I4784cf4059acecef7d3b97afcfbbb8058894e116
M src/main/java/com/android/tools/r8/ir/conversion/passes/SplitBranch.java
an...@gmail.com <an...@gmail.com> #27
Thanks for the quick fix/workaround! I can no longer reproduce the issue with the ALLOW_PARTIAL_REWRITE = false
in r8 8.3.39.
an...@google.com <an...@google.com> #29
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Jellyfish | 2023.3.1 Patch 1
- Android Gradle Plugin 8.4.1
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
ge...@paymentsense.com <ge...@paymentsense.com> #30
The issue continues to happen for us even with AGP 8.4.1. I am attaching the smali output here.
java.lang.VerifyError: Verifier rejected class com.pax.log.LogUtils: java.lang.StackTraceElement com.pax.log.LogUtils.getCaller(com.pax.log.b, java.lang.StackTraceElement[], int) failed to verify: java.lang.StackTraceElement com.pax.log.LogUtils.getCaller(com.pax.log.b, java.lang.StackTraceElement[], int): [0x21] type Undefined unexpected as arg to if-eqz/if-nez (declaration of 'com.pax.log.LogUtils' appears in /data/app/******-1/base.apk:classes8.dex)
at com.pax.log.LogUtils.isAndroid(LogUtils.java:125)
at com.pax.log.PaxLogWrapper.<init>(PaxLogWrapper.java:63)
at com.pax.log.PaxLogWrapper.<init>(PaxLogWrapper.java:52)
at com.pax.log.LogWrapperBinding.<clinit>(LogWrapperBinding.java:1)
at com.pax.log.LogWrapperBinding.registerLog(LogWrapperBinding.java:1)
at com.pax.poscomm.utils.CommLog.<clinit>(CommLog.java:1)
at com.pax.poscomm.utils.CommLog.v(CommLog.java:1)
at com.pax.poscomm.posapi.peripheries.NeptuneBase.getDalObjFromNeptuneLite(NeptuneBase.java:5)
at com.pax.poscomm.posapi.peripheries.NeptuneBase.getDalObjectFromNeptuneLib(NeptuneBase.java:6)
at com.pax.poscomm.posapi.peripheries.NeptuneBase.getClassLoader(NeptuneBase.java:2)
at com.pax.poscomm.posapi.peripheries.NeptuneBase.loadDex(NeptuneBase.java:4)
at com.pax.poslink.POSLinkAndroid.a(POSLinkAndroid.java:2)
at com.pax.poslink.POSLinkAndroid.init(POSLinkAndroid.java:21)
Description
As mentioned in this StackOverflow ticket here ->
We are getting a VerifierRejected error for our release variant of the app. The other variants work totally fine. For this prod release variant, the app directly crashes with a verifier error.
We use AGP 8.1.4 and everything works perfectly fine there (including the release variant). But if we update to anything above it like AGP 8.3.4 or 8.2.* the release build variant starts crashing. We are using Gradle 8.6 and I have tried with 8.7 but the same crash occurs only for release!
Unfortunately, I cannot provide code samples but I just wanted to know, are there any breaking changes in AGP 8.2 and upper? Is there a way to avoid this crash? Again, it only happens for release but not for debug. What is that is being executed additionally for release and not for debug?