Status Update
Comments
br...@snapchat.com <br...@snapchat.com> #2
I just tested with 8.1.36-dev and 8.2.0-dev and the issue is still present.
mk...@google.com <mk...@google.com> #3
br...@snapchat.com <br...@snapchat.com> #4
I can't share a repro, and the full dump contains a lot of proprietary info. Is there a subset of the dump I can share that would be helpful?
mk...@google.com <mk...@google.com> #5
Can you share the resulting apk and then the androidx.profileinstaller.ProfileInstallerInitializer$Choreographer16Impl class file from the dump (it should be in the program.jar inside the dump)
ap...@google.com <ap...@google.com> #6
ap...@google.com <ap...@google.com> #7
I've attached a zip with those files in a restricted comment.
br...@snapchat.com <br...@snapchat.com> #8
I can't repro the verification error with the attached apk, how do I repro, and what version of android did you repro on (dex2oat will fully compile this without issues on 6 and 12)
ap...@google.com <ap...@google.com> #9
I can repro on 8, 11, and 13. It crashes as soon as the app is opened.
ap...@google.com <ap...@google.com> #10
I get instead:
04-18 14:28:37.071 10648 10648 E AndroidRuntime: java.lang.VerifyError: Verifier rejected class cm3: void cm3.a() failed to verify: void cm3.a(): [0x11] 'this' argument 'Reference: java.lang.Object' not instance of 'Reference: android.content.Intent' (declaration of 'cm3' appears in /data/app/~~TahAr3SAlXyYMWqtCcVJdQ==/co.twenty.stop.spread.dev-BEXOTcDwQQRwcFf-P0JT0w==/base.apk)
Can you retrace that name and get me the corresponding class for cm3 and DV0 - if possible, share the mappingfile so that we can see the original signatures when looking into this.
ap...@google.com <ap...@google.com> #11
Oh I'm sorry, I was using the wrong mapping file. I'll get you that information shortly.
ap...@google.com <ap...@google.com> #12
If you don't want to share it on this bug feel free to mail it to
ap...@google.com <ap...@google.com> #13
ap...@google.com <ap...@google.com> #14
The code for ProcessRestarterImpl has a very strange pattern, probably from your dependency injection, where it will generate an array of type android/content/Intent
It will then call the Function0, which returns an Object, and store that into the array, which we pass on to call into ProcessPhoenix. This will actually type check, even when the types don't match, since you are allowed to put anything into the array (if the type is wrong, it would fail at runtime though when using the value)
R8 will inline the call to 'Lcom/jakewharton/processphoenix/ProcessPhoenix;triggerRebirth(Landroid/content/Context;[Landroid/content/Intent;)V', and since we track that only a single element was in the array it will simply reuse the value already in that register (i.e., not load from the array and check, simply use the 'java/lang/Object' value)
In this case, we should not do the elimination of the array load, since we can't guarantee the type
mk...@google.com <mk...@google.com> #15
Branch: main
commit 4799c3f590cd6725e6b21c7d5c69e3369b7fa623
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Apr 19 12:55:00 2023
Reproduce VerifyError after redundant array get elimination
Bug:
Change-Id: Ia2c62ad8f7a4c5f2d9333a6514a71f7d8db8720c
A src/test/java/com/android/tools/r8/ir/optimize/redundantarraygetelimination/ArrayGetTypePromotionTest.java
br...@snapchat.com <br...@snapchat.com> #16
Branch: main
commit 862bfb5e4301b8d085fe9d4a92fcb880d83b8386
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Apr 19 12:56:35 2023
Ensure redundant array get elimination leads to narrowing
Bug:
Change-Id: I5f4fd4f491ddac40d4e720862ab711220c0be145
M src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadAndStoreElimination.java
M src/test/java/com/android/tools/r8/ir/optimize/redundantarraygetelimination/ArrayGetTypePromotionTest.java
mk...@google.com <mk...@google.com> #17
Branch: 8.1
commit f98e89fc43f7a36661fcac1c11d8eed2a896865b
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Apr 19 14:16:18 2023
Version 8.1.38
Bug:
Change-Id: I47151eb88508eba9c9efe3fa637054f67a61bd5b
M src/main/java/com/android/tools/r8/Version.java
r....@gmail.com <r....@gmail.com> #18
lm...@gmail.com <lm...@gmail.com> #19
Branch: 8.1
commit 5ebb25ada2139cd2f74383d938f43a4640682b3e
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Apr 19 14:15:02 2023
Reproduce VerifyError after redundant array get elimination
Bug:
Change-Id: Ia2c62ad8f7a4c5f2d9333a6514a71f7d8db8720c
A src/test/java/com/android/tools/r8/ir/optimize/redundantarraygetelimination/ArrayGetTypePromotionTest.java
tw...@gmail.com <tw...@gmail.com> #20
Branch: 8.0
commit 1232278046bfec8d70bf4d0ff9891c732855bed1
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Apr 19 14:28:29 2023
Version 8.0.41
Bug:
Change-Id: I36de3c467318a872f9b52e6c1665a03cda894015
M src/main/java/com/android/tools/r8/Version.java
Description
Background
We upgraded from AGP 7.2.2 to AGP 7.4.2 and are now seeing hard class verification failures (crash on startup) on Android 11. It appears the root cause is due to the ApiModelOutliner now being enabled and having a weird interaction with our existing ApiHelper classes (as described here ).
I'll share artifacts (dex2oat logs, compiler dump) over email.
Details
Original Code:
Proguard Rules:
Smali Before (AGP 7.2):
Smali After (AGP 7.4):
Workaround
We can fix the crash by removing our proguard rules; however, we see that it will cause class verification failures to be re-introduced in other spots. In other words, ApiModelOutliner does not yet appear to be 100% effective so we'd need to keep our approach for the time being and thus revert back to AGP 7.2 in the interim.