Fixed
Status Update
Comments
vi...@google.com <vi...@google.com>
je...@google.com <je...@google.com>
ga...@google.com <ga...@google.com> #3
Root cause is:
Caused by: java.lang.VerifyError: Verifier rejected class com.google.android.material.appbar.AppBarLayout$Behavior: boolean com.google.android.material.appbar.AppBarLayout$Behavior.x(androidx.coordinatorlayout.widget.CoordinatorLayout, android.view.View, android.view.View, android.view.View, int, int) failed to verify: boolean com.google.android.material.appbar.AppBarLayout$Behavior.x(androidx.coordinatorlayout.widget.CoordinatorLayout, android.view.View, android.view.View, android.view.View, int, int): [0x2] 'this' argument 'Reference: com.google.android.material.appbar.AppBarLayout$Behavior' not instance of 'Precise Reference: de.wemode.bugdemo.CustomAppBarLayoutBehavior' (declaration of 'com.google.android.material.appbar.AppBarLayout$Behavior' appears in base.apk)
Using the attached project I was able to reproduce by running the app on emulator API 29. I've also attached the APK.
Here is the method that is causing the issue:
.method public bridge synthetic x(Landroidx/coordinatorlayout/widget/CoordinatorLayout;Landroid/view/View;Landroid/view/View;Landroid/view/View;II)Z
.registers 7
check-cast p2, Lcom/google/android/material/appbar/AppBarLayout;
invoke-virtual/range {p0 .. p6}, Lcom/google/android/material/appbar/AppBarLayout$BaseBehavior;->N(Landroidx/coordinatorlayout/widget/CoordinatorLayout;Lcom/google/android/material/appbar/AppBarLayout;Landroid/view/View;Landroid/view/View;II)Z
move-result p1
return p1
.end method
Søren, can you please take a look?
sg...@google.com <sg...@google.com> #4
This is an R8 bug introduced between 2.1.25-dev and 2.1.26-dev, more precisely by
git bisect start
# good: [5f086a0fb239f988c424b6e07bd6c97382616546] Deprecate TestBase.runtimeJar(Backend)
git bisect good 5f086a0fb239f988c424b6e07bd6c97382616546
# bad: [4732fa63e34129422d08843061e8597b19c691cd] Do not rewrite methods in the parser when doing resource shrinking
git bisect bad 4732fa63e34129422d08843061e8597b19c691cd
# good: [21953bac72b3831219fcffc2f1f5a764141b96d9] Remove unneeded assert bailout.
git bisect good 21953bac72b3831219fcffc2f1f5a764141b96d9
# good: [c9cf68284ff1bbcf49103edd3bfbba8551f7ca24] Harden assertion configuration analysis to allow input stack maps
git bisect good c9cf68284ff1bbcf49103edd3bfbba8551f7ca24
# bad: [53357603a80007f858d798e933921a43c6a1735f] Add support for flexible upper bound in kotlin metadata
git bisect bad 53357603a80007f858d798e933921a43c6a1735f
# bad: [603a4eb454ce107882bc9619c8b04f90ca9f8df0] Account for appInfo being null in AssemblyWriter
git bisect bad 603a4eb454ce107882bc9619c8b04f90ca9f8df0
# bad: [fd7372a8defbac071f3e960892d16f936100b036] Process kotlin.Metadata if the annotation will be output
git bisect bad fd7372a8defbac071f3e960892d16f936100b036
# bad: [15ead9f91812e5e564f68822cd972d0ac025dc24] Generalize bridge hoisting
git bisect bad 15ead9f91812e5e564f68822cd972d0ac025dc24
# first bad commit: [15ead9f91812e5e564f68822cd972d0ac025dc24] Generalize bridge hoisting
sg...@google.com <sg...@google.com> #5
I have found the issue, and will send out a CL soon. It is caused by the bridge hoisting only rewriting invokes with 5 arguments or less (invoke-virtual
and not innvoke-virtual/range
) in hoisted bridges.
For the sample a valid workaround it this keep rule:
-keep class de.wemode.bugdemo.CustomAppBarLayoutBehavior {
onStartNestedScroll(...);
}
js...@twitter.com <js...@twitter.com> #6
We've encountered this issue too and it is blocking us from migrating to 4.1. Is there a workaround?
ca...@gmail.com <ca...@gmail.com> #7
Thanks a lot for the expedited response.
I can also confirm the work-around.
Am Do., 30. Juli 2020 um 20:06 Uhr schrieb <buganizer-system@google.com>:
I can also confirm the work-around.
Am Do., 30. Juli 2020 um 20:06 Uhr schrieb <buganizer-system@google.com>:
ap...@google.com <ap...@google.com> #8
Project: r8
Branch: master
commit f7f75babade8fc06bf0ed9d045f2527058524439
Author: Søren Gjesse <sgjesse@google.com>
Date: Mon Aug 03 09:20:18 2020
Handle invoke-virtual/range when hoisting bridge methods
Bug: 161403944
Change-Id: I226aad383ea77b5ddef9cedab385363c8c2000bf
M src/main/java/com/android/tools/r8/code/Instruction.java
M src/main/java/com/android/tools/r8/code/InvokeVirtualRange.java
M src/main/java/com/android/tools/r8/optimize/BridgeHoisting.java
M src/test/java/com/android/tools/r8/bridgeremoval/hoisting/BridgeHoistingAccessibilityTest.java
M src/test/java/com/android/tools/r8/bridgeremoval/hoisting/testclasses/BridgeHoistingAccessibilityTestClasses.java
https://r8-review.googlesource.com/52680
Branch: master
commit f7f75babade8fc06bf0ed9d045f2527058524439
Author: Søren Gjesse <sgjesse@google.com>
Date: Mon Aug 03 09:20:18 2020
Handle invoke-virtual/range when hoisting bridge methods
Bug: 161403944
Change-Id: I226aad383ea77b5ddef9cedab385363c8c2000bf
M src/main/java/com/android/tools/r8/code/Instruction.java
M src/main/java/com/android/tools/r8/code/InvokeVirtualRange.java
M src/main/java/com/android/tools/r8/optimize/BridgeHoisting.java
M src/test/java/com/android/tools/r8/bridgeremoval/hoisting/BridgeHoistingAccessibilityTest.java
M src/test/java/com/android/tools/r8/bridgeremoval/hoisting/testclasses/BridgeHoistingAccessibilityTestClasses.java
ap...@google.com <ap...@google.com> #9
Project: r8
Branch: 2.1
commit 98c097c58b9ca4671cfa4b6f625ffa94979b0af8
Author: Søren Gjesse <sgjesse@google.com>
Date: Mon Aug 03 14:18:52 2020
Version 2.1.54
Cherry-pick: Handle invoke-virtual/range when hoisting bridge methods
CL:https://ci.chromium.org/p/r8/g/main_all/console
Bug: 161403944
Change-Id: I12c06dcf6aab4cdb87f3842f4263378074ceda31
M src/main/java/com/android/tools/r8/Version.java
M src/main/java/com/android/tools/r8/code/Instruction.java
M src/main/java/com/android/tools/r8/code/InvokeVirtualRange.java
M src/main/java/com/android/tools/r8/optimize/BridgeHoisting.java
M src/test/java/com/android/tools/r8/bridgeremoval/hoisting/BridgeHoistingAccessibilityTest.java
M src/test/java/com/android/tools/r8/bridgeremoval/hoisting/testclasses/BridgeHoistingAccessibilityTestClasses.java
https://r8-review.googlesource.com/52701
Branch: 2.1
commit 98c097c58b9ca4671cfa4b6f625ffa94979b0af8
Author: Søren Gjesse <sgjesse@google.com>
Date: Mon Aug 03 14:18:52 2020
Version 2.1.54
Cherry-pick: Handle invoke-virtual/range when hoisting bridge methods
CL:
Bug: 161403944
Change-Id: I12c06dcf6aab4cdb87f3842f4263378074ceda31
M src/main/java/com/android/tools/r8/Version.java
M src/main/java/com/android/tools/r8/code/Instruction.java
M src/main/java/com/android/tools/r8/code/InvokeVirtualRange.java
M src/main/java/com/android/tools/r8/optimize/BridgeHoisting.java
M src/test/java/com/android/tools/r8/bridgeremoval/hoisting/BridgeHoistingAccessibilityTest.java
M src/test/java/com/android/tools/r8/bridgeremoval/hoisting/testclasses/BridgeHoistingAccessibilityTestClasses.java
Description
Build: AI-201.7846.76.41.6636797, 202006282347,
AI-201.7846.76.41.6636797, JRE 1.8.0_242-release-1644-b01x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 2048x1152
AS: 4.1 Beta 3; Kotlin plugin: 1.3.72-release-Studio4.1-5; Android Gradle Plugin: 4.1.0-beta03; Gradle: 6.5; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: (not found)
When enabling minify for my project, I am getting a
java.lang.VerifyError
at runtime when the view hierarchy is inflated. The root cause is:java.lang.VerifyError: Rejecting class de.wemode.bugdemo.CustomAppBarLayoutBehavior that attempts to sub-type erroneous class com.google.android.material.appbar.AppBarLayout$Behavior (declaration of 'de.wemode.bugdemo.CustomAppBarLayoutBehavior' appears in base.apk)
The class in question is a Kotlin subclass of
AppBarLayout.Behavior
, which defined in the project and attached to anAppBarLayout
slayout_behavior
attribute via the layout resource xml.The problem does not occur when
minifyEnabled
tofalse