epoxy: Crash on Android 12
According to Firebase Crashlytics users with Google Pixel Devices and Android 11 are experiencing crashes every time they start up our app. I belive that that data is not correct and its actually Android 12 Beta as a few users stated that they can’t start the app and I can’t see any A12 non fatal errors logged aswell.
Unfortunately I can’t reproduce the error on emulators or physical devices (including Pixel devices) running Android 11 or 12.
Fatal Exception: com.airbnb.epoxy.IllegalEpoxyUsage: You must set an id on a model before adding it. Use the @AutoModel annotation if you want an id to be automatically generated for you.
at com.airbnb.epoxy.EpoxyController.addInternal(EpoxyController.java:502)
at com.airbnb.epoxy.EpoxyModel.addTo(EpoxyModel.java:337)
The error is a bit missleading as I am setting an id via the builder pattern with .id("***")
before calling .addTo(this)
But I have no idea what the real cause is.
epoxy Version: 4.6.1 (it’s also happening on older versions e.g. 4.0.0-beta6)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 9
- Comments: 57 (7 by maintainers)
Commits related to this issue
- https://github.com/airbnb/epoxy/issues/1199 (#1234) - temporary workaround (https://issuetracker.google.com/issues/197818595#comment20) suggested by google engineer: - In generated kotlin extension ... — committed to airbnb/epoxy by blah1234 3 years ago
- Revert "https://github.com/airbnb/epoxy/issues/1199 (#1234)" This reverts commit 2363f5809e3e2b65907b09f170f8c3460bdc1b80. — committed to airbnb/epoxy by rossbacher 3 years ago
- Revert "https://github.com/airbnb/epoxy/issues/1199 (#1234)" (#1238) This reverts commit 2363f5809e3e2b65907b09f170f8c3460bdc1b80. — committed to airbnb/epoxy by rossbacher 3 years ago
We are also experiencing this issue using epoxy 4.6.3 on Android 12.
We have same issue with epoxy version 4.6.3 and stable AN12 @a10033135
This unfortunately doesn’t seem to change anything - I’ve just released an update and the crashes are still there.
Can you do something please? All problems are with stable AN 12. We have lot of crashes in firebase with latest epoxy version. Any advice?
I am experiencing crashes with epoxy 4.6.3 on AN 12 (Pixel devices).
Android 12 on Pixel devices with 4.6.3 is crashing
I’m experiencing the same issue 😦
Got some good news from Googles bugtracker related to this issue:
Just as another data point we’re also seeing this on stable Android 12. However somewhat interestingly we’re using
proguard-android.txt
which has-dontoptimize
set, so I think outlining should already be disabled. Decompiled the released APK and found that indeed it doesn’t look like it is outlining:@woodii you really don’t want to use some unauthorized R8 version, I could inject anything into your code. I had sadly no luck with providing a patch to Google as they block contribution on the R8 repo and I had not luck reaching out to get myself allowed to contribute. But let me explain of what I did and you can do the same and build your own R8 fork.
This is for 2.2.66 version of R8, which is the one that AGP 4.2.1 is depends on, but the same can be done to any R8 version.
The only thing you need to do is go here: https://r8.googlesource.com/r8/+/refs/tags/2.2.66/src/main/java/com/android/tools/r8/utils/InternalOptions.java#164 and insert after that line:
You might also want to update the version here: https://r8.googlesource.com/r8/+/refs/tags/2.2.66/src/main/java/com/android/tools/r8/Version.java
Then run
tools/build_r8lib.py -e
which will build the lib. You can publish it to local maven using the pom file of the original (with updated version) https://mvnrepository.com/artifact/com.android.tools/r8?repo=googleIf on a mac I’d do all of that inside a disk image which is case sensitive (that is what i did) just to be sure that case is not an issue here.
To use the version that you just created just add a dependency to
com.android.tools:r8:<version>
to yourbuild.gradle
file before you define your dependency to AGP. If you have a buildSrc folder, do the same thing in thebuild.gradle
file in there.Now you can disable outlining by just adding
systemProp.com.android.tools.r8.disableoutlining=true
to yourgradle.properties
file.either I failed and outlining was still enabled or modifying r8 doesn’t help at all -.-