Status Update
Comments
ch...@google.com <ch...@google.com>
ch...@google.com <ch...@google.com> #2
Stack trace:
12-13 10:45:18.610 6115 6115 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.r8bug/com.example.r8bug.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'void java.util.Map.clear()' on a null object reference
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at android.os.Looper.loop(Looper.java:193)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6669)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void java.util.Map.clear()' on a null object reference
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at com.flurry.sdk.aj.<init>(SourceFile:12)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at com.flurry.sdk.eu.a(SourceFile:1)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at com.example.r8bug.MainActivity.onCreate(SourceFile:77)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:7136)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:7127)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
12-13 10:45:18.610 6115 6115 E AndroidRuntime: ... 11 more
ch...@google.com <ch...@google.com> #3
Stack trace with horizontal class merging disabled in main (f74be29a69e8cd53a92b8d8687647ec9e51fc681):
12-13 10:59:32.474 6584 6584 W System.err: Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void java.util.Map.clear()' on a null object reference
12-13 10:59:32.474 6584 6584 W System.err: at com.flurry.sdk.eu.<init>(SourceFile:142)
12-13 10:59:32.474 6584 6584 W System.err: at com.flurry.sdk.eu.a(SourceFile:1)
12-13 10:59:32.474 6584 6584 W System.err: at com.example.r8bug.MainActivity.onCreate(SourceFile:77)
12-13 10:59:32.474 6584 6584 W System.err: at android.app.Activity.performCreate(Activity.java:7136)
12-13 10:59:32.474 6584 6584 W System.err: at android.app.Activity.performCreate(Activity.java:7127)
12-13 10:59:32.474 6584 6584 W System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
12-13 10:59:32.474 6584 6584 W System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
12-13 10:59:32.474 6584 6584 W System.err: ... 11 more
ap...@google.com <ap...@google.com> #4
Branch: main
commit dd3a0cccf67bbb143f4ecb55efc35a190a4f4a68
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Dec 13 14:13:09 2023
Add reproduction of incorrect instance-get canonicalization
Bug:
Change-Id: I26a84ab7f6224e39e00c8d6fa532ec9462a00c0b
A src/test/java/com/android/tools/r8/ir/optimize/canonicalization/EffectivelyFinalInstanceFieldCanonicalizationAfterConstructorInliningTest.java
ap...@google.com <ap...@google.com> #5
Branch: main
commit f3ea471d3afc338644b2c86037c74573825e427c
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Dec 13 14:22:56 2023
Fix incorrect instance-get canonicalization
Fixes:
Change-Id: I09db1a0e0cb1b873417a1fe55a3ca5d782e77455
M src/main/java/com/android/tools/r8/ir/optimize/ConstantCanonicalizer.java
M src/test/java/com/android/tools/r8/ir/optimize/canonicalization/EffectivelyFinalInstanceFieldCanonicalizationAfterConstructorInliningTest.java
ap...@google.com <ap...@google.com> #6
Branch: 8.2
commit 5c1e06d74b382c4f1500fc9df3303a91e8b1fc9e
Author: Søren Gjesse <sgjesse@google.com>
Date: Wed Dec 13 14:53:59 2023
Add reproduction of incorrect instance-get canonicalization
Bug:
Change-Id: I26a84ab7f6224e39e00c8d6fa532ec9462a00c0b
A src/test/java/com/android/tools/r8/ir/optimize/canonicalization/EffectivelyFinalInstanceFieldCanonicalizationAfterConstructorInliningTest.java
ap...@google.com <ap...@google.com> #7
Branch: 8.2
commit 0d131ff42509de0c9515bc580c2ad3e4cbf30e00
Author: Søren Gjesse <sgjesse@google.com>
Date: Wed Dec 13 14:54:14 2023
Fix incorrect instance-get canonicalization
Fixes:
Change-Id: I09db1a0e0cb1b873417a1fe55a3ca5d782e77455
M src/main/java/com/android/tools/r8/ir/optimize/ConstantCanonicalizer.java
M src/test/java/com/android/tools/r8/ir/optimize/canonicalization/EffectivelyFinalInstanceFieldCanonicalizationAfterConstructorInliningTest.java
ap...@google.com <ap...@google.com> #8
Branch: 8.2
commit 12d495d9e6e5d8ba2b5a930d3881401415efc9b2
Author: Søren Gjesse <sgjesse@google.com>
Date: Wed Dec 13 14:54:33 2023
Version 8.2.42
Bug:
Change-Id: I70143dffc799f38c9b2aec18d983b2421259fcaf
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #9
Branch: 8.3
commit c806f4bf2b33493cd37b260ed5e4e53705c7f8e5
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Dec 13 15:26:12 2023
Add reproduction of incorrect instance-get canonicalization
Bug:
Change-Id: I26a84ab7f6224e39e00c8d6fa532ec9462a00c0b
A src/test/java/com/android/tools/r8/ir/optimize/canonicalization/EffectivelyFinalInstanceFieldCanonicalizationAfterConstructorInliningTest.java
ap...@google.com <ap...@google.com> #10
Branch: 8.3
commit 9acb29ddd89498d46664ad30b2590f27a24e103d
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Dec 13 15:26:43 2023
Version 8.3.24
Bug:
Change-Id: I023d9dd0a1e1aa6181e2810ce93fd91d0ef08724
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #11
Branch: 8.3
commit 80b695a3fd870c1a059562eb1d9e1773295aec58
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Dec 13 15:26:30 2023
Fix incorrect instance-get canonicalization
Fixes:
Change-Id: I09db1a0e0cb1b873417a1fe55a3ca5d782e77455
M src/main/java/com/android/tools/r8/ir/optimize/ConstantCanonicalizer.java
M src/test/java/com/android/tools/r8/ir/optimize/canonicalization/EffectivelyFinalInstanceFieldCanonicalizationAfterConstructorInliningTest.java
sg...@google.com <sg...@google.com> #12
The fix has been merged to the 8.2 release branch in 8.2.42, and you can use that version by merging the following into settings.gradle
or settings.gradle.kts
:
pluginManagement {
buildscript {
repositories {
mavenCentral()
maven {
url = uri("https://storage.googleapis.com/r8-releases/raw")
}
}
dependencies {
classpath("com.android.tools:r8:8.2.42")
}
}
}
The fix is scheduled for the next patch release, so please remember to remove this use of a specific R8 version again when updating AGP to a version with the fix.
an...@google.com <an...@google.com> #13
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 Iguana | 2023.2.1 Beta 1
- Android Gradle Plugin 8.3.0-beta01
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!
an...@google.com <an...@google.com> #14
The fixes for this issue are now also available in:
- Android Studio Hedgehog | 2023.1.1 Patch 1
- Android Gradle Plugin 8.2.1
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
mk...@opera.com <mk...@opera.com> #15
We encountered similar issue. Tried R8
8.2.42
as suggested in this thread and the issue is gone, but the minifyReleaseWithR8
task became super slow. Haven't done any detailed measures yet but just looking at logs from our CI the minifyReleaseWithR8
takes:
AGP 8.0.2 -> ~6 minutes
AGP 8.2.0 -> Varies between runs but is usually worse than in 8.0.2, I've seen numbers in between ~ 10-15 minutes. In rare cases timeouts after 20minutes which is the limit we currently have on CI
AGP 8.2.0 with R8 8.2.42 -> Never completes within 20minutes timeout on our CI
ch...@google.com <ch...@google.com> #16
Thanks for the feedback. It would be great if you could file a separate issue for that.
Looking over the commits that went in between R8 version 8.2.33 (AGP 8.2.0) and R8 version 8.2.42, it is not really clear that anyone should cause an additional build speed regression. Perhaps R8 8.2.40 due to
Would it be possible for you to share a zip dump of the compiler inputs (containing the app's JVM class files, keep rules, etc.)? That way we should be able to reproduce the issue. You can share the dump privately with
You can generate a dump like this:
./gradlew assembleRelease --no-daemon -Dcom.android.tools.r8.dumpinputtodirectory=/path/to/dumps
Alternatively, it would be great if you could share some timings from compiling using different R8 versions (e.g., 8.0.X, 8.1.75, 8.2.33, 8.2.43). You should be able to dump timing info by issuing the following command:
./gradlew assembleRelease --no-daemon -Dcom.android.tools.r8.printtimes -Dcom.android.tools.r8.printtimes.minvalue=0
You can build using a specific R8 version without changing the AGP version by making the following changes to settings.gradle
.
pluginManagement {
buildscript {
repositories {
mavenCentral()
maven {
url = uri("https://storage.googleapis.com/r8-releases/raw")
}
}
dependencies {
classpath("com.android.tools:r8:8.2.43")
}
}
}
Description
Attached a sample project which reproduces the crash when the release variant is built. Change AGP back to 8.1.4 and the crash no longer occurs.
The bytecode after running through R8 looks wrong
The original code in the constructor of com.flurry.sdk.ft in the SDK is (according to the intellij decompiler)
With the R8 in 8.2.0, the whole constructor is inlined a few levels above, and the resulting bytecode assigns the field but looks like the local reference ends up in v1 instead of v0?
With 8.1.4 the inlining doesn't happen, and looks like there's some redundancy in the bytecode, but it's at least correct.