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

Most upvoted comments

We are also experiencing this issue using epoxy 4.6.3 on Android 12.

Android 12 was released today, Has anyone tested the same issue Or confirm that this issue has been fixed? Many thanks in advance!

We have same issue with epoxy version 4.6.3 and stable AN12 @a10033135

Maybe release an update of the app? Did someone already tried this?

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?

Android 12 was released today, Has anyone tested the same issue Or confirm that this issue has been fixed? Many thanks in advance!

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

Android 12 was released today, Has anyone tested the same issue Or confirm that this issue has been fixed? Many thanks in advance!

I’m experiencing the same issue 😦

Got some good news from Googles bugtracker related to this issue:

I reproed and found the offending ART optimization that triggers this. The optimization is only in Android 12. Investigating now on a fix.

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:

q0 var3 = new q0();
var5 = qf.l.a;

@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:

outline.enabled = System.getProperty("com.android.tools.r8.disableoutlining") == null;

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=google

If 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 your build.gradle file before you define your dependency to AGP. If you have a buildSrc folder, do the same thing in the build.gradle file in there.

Now you can disable outlining by just adding systemProp.com.android.tools.r8.disableoutlining=true to your gradle.properties file.

either I failed and outlining was still enabled or modifying r8 doesn’t help at all -.-