New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
R8 - ClassCastException because of removed EntryPoint HiltWrapper_ classes #3386
Comments
This sounds like an R8 optimization issue, similar to #2291 (comment). Can you tell us more about your proguard / r8 configuration. It would be helpful too if you shared some of reports as mentioned here: https://developer.android.com/studio/build/shrink-code#troubleshoot |
Noticed this was reported not so long ago too: #2226. They had a non-public EntryPoint which I think you also have. Maybe we should report this to the R8 team, as it might be an interface merging issue. |
Thank you @danysantiago for your response, really appreciate your help. Actually was working on a side project trying to reproduce the issue for you and nearly found it. The main issue is that hilt cannot work with libraries in release mode, meaning I cannot generate a release aar build (minification enabled) as it needs an application that will be provided later by library users. I'm just curious if there is something else we can do about it. |
@danysantiago I've created the application to reproduce the issue |
Thanks for the repro! The issue is not with Hilt itself but just with the nature of minification, by shrinking a library and not the final APK you need to add rules to keep your public APIs since from R8's perspective, many classes, including the SDK APIs are not used and will get removed. I see the project already has a rule for classes in your package but with code generating libraries like Dagger and Hilt you need to also consider the generated classes and specifically keep those too. Hilt for example, generates various metadata classes in a special package called Note that this is a general trade-off when minifying or obfuscating a library, you need to verify the produced library has its public API as desired, including generated code, where as if R8 is run in the app, then it can figure out what is being used from the app and remove unnecessary code, including code from consumed libraries. |
R8 is failing on a release build and working normally on debug.
and After Decompiling the application found out that
DemoApplication_HiltComponents$SingletonC
doesn't implement theHiltWrapper_CustomEntryPoint
class it's removed completely from the class signature. And it does appear on debug builds.The text was updated successfully, but these errors were encountered: