OiO.lk Blog Android R8 removes entire classes it shouldn't
Android

R8 removes entire classes it shouldn't


After migrating Gradle from 8.4 to 8.9 and Gradle plugin from 8.3.2 to 8.7.0, R8 is failing when building a signed release APK.

Missing class com.my.package.MyClass$Companion (referenced from: void common.my.package.workers.SyncWorker.<init>(android.content.Context, androidx.work.WorkerParameters, com.my.package.Dao))

It fails with many more missing classes. I did add -keep class com.my.package.** { *; } to the app module (in proguard-rules.txt) and to my other modules (in consumer-rules.txt) but to no avails. I also added android.enableR8.fullMode=false to my gradle.properties but it didn’t change anything. Android Studio do generates missing-rules.txt with a bunch of -dontwarn which make the build pass but the app crashes right away with the same missing classes error.

Any Idea of how I can fix this? I see the documentation saying



You need to sign in to view this answers

Exit mobile version