exact error is
ERROR: /Users/REDACT/.gradle/caches/transforms-4/8d2b49e30523efece47d2329e1531ac9/transformed/classes.jar: R8: Type a.a is defined multiple times: /Users/mgh01/.gradle/caches/transforms-4/8d2b49e30523efece47d2329e1531ac9/transformed/classes.jar:a/a.class, /Users/REDACT/.gradle/caches/transforms-4/196d8149ca78d42bf3bbca1f74e91807/transformed/classes.jar:a/a.class
I've looked up the classes.jar of both and the offending class is just
an
public interface a {}
This is all come off the back of updating the AGP to the latest 8.5.0.
Also running R8 in the "compatibility" mode makes no difference.
I've also tried to disable obfuscation so I can see what a is meant to be but it the same
Any help would be appreciated
I had a similar problem and found a fix for my project composed of :
an App module
plugins { id 'com.android.application' }
some other library modules
plugins { id 'com.android.library') }
It worked fine with AGP <= 8.3.2 but stopped working with 8.4.0+
The fix consisted to enable Minification only at the App Level for the release buildType.
In build.gradule (Module: app):
buildTypes {
debug {
minifyEnabled false
}
release {
minifyEnabled true
}
}
and in other modules:
buildTypes {
debug {
minifyEnabled false
}
release {
minifyEnabled false
}
}
I think it may have something to do with the note about "Library classes are shrunk" in the release note of AGP 8.4.0 and the parameter android.disableMinifyLocalDependenciesForLibraries in the gradle.properties (though it didn't work for my project)
cf: https://developer.android.com/build/releases/past-releases/agp-8-4-0-release-notes?hl=fr#library-classes-shrunk
More, in Android builds, R8 is run once during the final stage of building the APK or AAB, which is the step where the entire application is assembled:
The minifyEnabled flag at the app module level means that all the code, including code from library modules, is considered during minification. If library modules have minifyEnabled set to true, they would attempt to minify their code independently, potentially leading to conflicts when the app module tries to do the same during its build process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With