Status Update
Comments
dr...@gmail.com <dr...@gmail.com> #2
Update: It seems that something is very wrong there, because when I downgraded Firebase to implementation platform('com.google.firebase:firebase-bom:32.0.0')
, a similar error happened at a completely different place:
> Task :app:minifyReleaseWithR8 FAILED
ERROR: /home/<redacted>/.gradle/caches/transforms-3/5e9dc6f747814a530f3ab1a07bd31f02/transformed/material-1.9.0-runtime.jar: R8: com.android.tools.r8.internal.Tb: 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.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:minifyReleaseWithR8'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.R8Task$R8Runnable
> Compilation failed to complete, position: Lcom/google/android/material/internal/ManufacturerUtils;unwrapPosition(Landroidx/recyclerview/widget/RecyclerView$Adapter;Lcom/h6ah4i/android/widget/advrecyclerview/draggable/DraggableItemWrapperAdapter;Ljava/lang/Object;ILcom/caverock/androidsvg/CSSParser$Ruleset;)I, origin: /home/<redacted>/.gradle/caches/transforms-3/5e9dc6f747814a530f3ab1a07bd31f02/transformed/material-1.9.0-runtime.jar:com/google/android/material/internal/ManufacturerUtils.class
This time the source code of Material Components for Android is available, and thatManufacturerUtils
class doesn't have such a method or reference those classes at all. Maybe something wrong with class merging etc?
The actual unwrapPosition()
method is probably com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils#unwrapPosition(androidx.recyclerview.widget.RecyclerView.Adapter, androidx.recyclerview.widget.RecyclerView.Adapter, java.lang.Object, int)
from
dr...@gmail.com <dr...@gmail.com> #3
I tested 8.1.60
and this still fails.
Then I tested dev tags and found that build is fixed by something 8.2.14-dev
and 8.2.15-dev
However, the APKs built with 8.2.15-dev
, 8.2.21-dev
and 8.3.1-dev
are all failing with VerifyError
during runtime:
FATAL EXCEPTION: main
Process: me.zhanghai.android.files, PID: 9596
java.lang.VerifyError: Verifier rejected class x3.p4: int x3.p4.x(l1.x0, y6.g, java.lang.Object, int, m2.k) failed to verify: int x3.p4.x(l1.x0, y6.g, java.lang.Object, int, m2.k): [0x2F] args to if-eq/if-ne (Reference: l1.x0,Imprecise Constant: -128) must both be references or integral (declaration of 'x3.p4' appears in /data/app/~~K-diqAnjAPpWs7OV0XyRGw==/me.zhanghai.android.files-Cp7CvgB8vCz3Yx8zuMLrww==/base.apk)
at x3.p4.d(SourceFile:1)
at o5.i.<init>(SourceFile:191)
at j5.g.<init>(SourceFile:365)
at j5.g.f(SourceFile:40)
at j5.g.e(SourceFile:1)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source:11)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2451)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2421)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:13)
at android.app.ActivityThread.installProvider(ActivityThread.java:7462)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6973)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6744)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2133)
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:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
So right now there's still no way to get a working optimized APK.
ze...@google.com <ze...@google.com>
dr...@gmail.com <dr...@gmail.com> #4
Update: This issue can be worked around by turning off R8 full mode (or downgrading to AGP 7.x which doesn't enable R8 full mode by default). Still, it would be nice if the app can use R8 full mode.
If you want to reproduce this issue, please locally revert
ze...@google.com <ze...@google.com> #5
Thanks for reporting the issue and for the reproduction project. It reproduces locally with the update. I'll post back once I have more info on the issue.
ze...@google.com <ze...@google.com> #6
This issue is due to an error when R8 does redundant field load elimination. There is a corner case where the field values may cause simplifications of values to be replaced and that results in stale references to values that have been optimized out. I'll post back info once we have a fix on our release branches.
ap...@google.com <ap...@google.com> #7
Branch: main
commit b3352468ccd4f0b9851cf3d661203d6874f5b029
Author: Ian Zerny <zerny@google.com>
Date: Mon Aug 21 14:56:49 2023
Regression and fix for trivial-phi issue in field get removal
Bug:
Change-Id: Ifca4c63f1a9a1dd3291abd7d27deb06fba929a7c
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
A src/test/java/com/android/tools/r8/ir/optimize/redundantfieldloadelimination/RedundantFieldLoadEliminationTrivialPhiTest.java
ap...@google.com <ap...@google.com> #8
Branch: 8.1
commit f4774aee4dd52f42a2a79e7197fcf7a91e61b081
Author: Ian Zerny <zerny@google.com>
Date: Tue Aug 22 08:48:52 2023
Regression and fix for trivial-phi issue in field get removal
Bug:
Change-Id: Ifca4c63f1a9a1dd3291abd7d27deb06fba929a7c
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
A src/test/java/com/android/tools/r8/ir/optimize/redundantfieldloadelimination/RedundantFieldLoadEliminationTrivialPhiTest.java
ap...@google.com <ap...@google.com> #9
Branch: 8.1
commit 73775ccb7f7c86899acc5eb366551e0d787e89c6
Author: Ian Zerny <zerny@google.com>
Date: Tue Aug 22 08:32:53 2023
Version 8.1.66
Bug:
Change-Id: Ie29d8f397ed18512f9f833fa6255e22eb907e394
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #10
Branch: 8.2
commit 8cf7bf9dbec1c4342b26d0201a8ade999f21443a
Author: Ian Zerny <zerny@google.com>
Date: Tue Aug 22 09:32:38 2023
Version 8.2.25
Bug:
Change-Id: I846f16fc862ee60b8e0cfbe5a54f5e2f56f6c481
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #11
Branch: 8.2
commit 4c60fbcbcee7d387e6effb8426cec27a61a9e785
Author: Ian Zerny <zerny@google.com>
Date: Tue Aug 22 09:32:25 2023
Regression and fix for trivial-phi issue in field get removal
Bug:
Change-Id: Ifca4c63f1a9a1dd3291abd7d27deb06fba929a7c
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
A src/test/java/com/android/tools/r8/ir/optimize/redundantfieldloadelimination/RedundantFieldLoadEliminationTrivialPhiTest.java
ap...@google.com <ap...@google.com> #12
Branch: 4.0
commit d36bdedf23f4089aab81b857047726e6fb264fee
Author: Ian Zerny <zerny@google.com>
Date: Mon Aug 21 15:30:49 2023
Regression and fix for trivial-phi issue in field get removal
Bug:
Change-Id: Ifca4c63f1a9a1dd3291abd7d27deb06fba929a7c
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
A src/test/java/com/android/tools/r8/ir/optimize/redundantfieldloadelimination/RedundantFieldLoadEliminationTrivialPhiTest.java
ap...@google.com <ap...@google.com> #13
Branch: 4.0
commit 434d7229079692f7c844a966e4488583652afcd0
Author: Ian Zerny <zerny@google.com>
Date: Mon Aug 21 15:31:02 2023
Version 4.0.68
Bug:
Change-Id: If57a8daddb6705e267d92e29052e55b0d8df3324
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #14
Branch: 8.0
commit 32b14e9bf44e8be586a2bd360b0ee10a0c8d721b
Author: Ian Zerny <zerny@google.com>
Date: Mon Aug 21 15:38:51 2023
Regression and fix for trivial-phi issue in field get removal
Bug:
Change-Id: Ifca4c63f1a9a1dd3291abd7d27deb06fba929a7c
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
A src/test/java/com/android/tools/r8/ir/optimize/redundantfieldloadelimination/RedundantFieldLoadEliminationTrivialPhiTest.java
ap...@google.com <ap...@google.com> #15
Branch: 8.0
commit d64ab925c6e287ca1c7a3fbb16621429ac76c22b
Author: Ian Zerny <zerny@google.com>
Date: Mon Aug 21 15:39:23 2023
Version 8.0.63
Bug:
Change-Id: I848de6da54c737314fb7014a8205bf9f689bbf7a
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #16
Branch: 8.1
commit f4774aee4dd52f42a2a79e7197fcf7a91e61b081
Author: Ian Zerny <zerny@google.com>
Date: Tue Aug 22 08:48:52 2023
Regression and fix for trivial-phi issue in field get removal
Bug:
Change-Id: Ifca4c63f1a9a1dd3291abd7d27deb06fba929a7c
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
A src/test/java/com/android/tools/r8/ir/optimize/redundantfieldloadelimination/RedundantFieldLoadEliminationTrivialPhiTest.java
ap...@google.com <ap...@google.com> #17
Branch: 4.0
commit d36bdedf23f4089aab81b857047726e6fb264fee
Author: Ian Zerny <zerny@google.com>
Date: Mon Aug 21 15:30:49 2023
Regression and fix for trivial-phi issue in field get removal
Bug:
Change-Id: Ifca4c63f1a9a1dd3291abd7d27deb06fba929a7c
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
A src/test/java/com/android/tools/r8/ir/optimize/redundantfieldloadelimination/RedundantFieldLoadEliminationTrivialPhiTest.java
ap...@google.com <ap...@google.com> #18
Branch: 8.0
commit 32b14e9bf44e8be586a2bd360b0ee10a0c8d721b
Author: Ian Zerny <zerny@google.com>
Date: Mon Aug 21 15:38:51 2023
Regression and fix for trivial-phi issue in field get removal
Bug:
Change-Id: Ifca4c63f1a9a1dd3291abd7d27deb06fba929a7c
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
A src/test/java/com/android/tools/r8/ir/optimize/redundantfieldloadelimination/RedundantFieldLoadEliminationTrivialPhiTest.java
ze...@google.com <ze...@google.com> #19
Thanks again for reporting this issue and for the reproduction. A fix has landed on each of the R8 release branches, so you can update your config to the version suitable for your AGP release. Let us know if any issues remain.
dr...@gmail.com <dr...@gmail.com> #20
I can confirm that both build time error and run time VerifyError is fixed on API 21 and API 33 emulators, with tag 8.3.2-dev
which includes the fix:
repositories {
...
maven {
url = uri("https://storage.googleapis.com/r8-releases/raw")
}
}
dependencies {
classpath 'com.android.tools:r8:8.3.2-dev'
...
}
Do you know when this fix will make it into a stable release?
ze...@google.com <ze...@google.com> #21
The fix did not make it for the AGP 8.1.1 point release, so it would first be included if another point release is made. It will be the stable release of 8.2 when that is cut.
ze...@google.com <ze...@google.com> #22
Also, the fix is on the R8 release branches so you can use the one that matches your AGP instead of using our -dev
branch which is not very stable.
an...@google.com <an...@google.com> #23
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 Giraffe | 2022.3.1 Patch 2
- Android Gradle Plugin 8.1.2
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!
sx...@gmail.com <sx...@gmail.com> #24
It seems to me that this variant is more acceptable, but I am not completely sure to argue it
Description
Error:
Steps to reproduce:
git revert 1ae5a81
to stop disabling R8 full mode.signing.properties
by followingsigning.properties.example
in the project, i.e. generate a signing key and fill it in../gradlew clean build
.Note that I have tried deleting my gradle cache (
$HOME/.gradle/
), but the issue persisted even after the cache is cleared.