Status Update
Comments
sg...@google.com <sg...@google.com> #2
Do you have core library desugaring enabled in module y as well?
ka...@infinum.com <ka...@infinum.com> #3
I didn't have core library desugaring enabled in module y. This worked for older AGP.
But after enabling it now in module y (with AGP 8.3.0) I am not getting error.
sg...@google.com <sg...@google.com> #4
Thank you for trying that out. Happy that it now works.
Moving this to the AGP component to validate if this is WAI.
ti...@volvocars.com <ti...@volvocars.com> #5
8.1.4 -> OK
Everything from 8.2.0 -> Issue as described above.
It also solves it for me to introduce desugaring for more modules, but quite a lot of modules are affected and it increases app size (and build time?). I would also like to understand how the Android Gradle Plugin affects desugaring.
al...@gmail.com <al...@gmail.com> #6
This is happening to me as well but only if I rebuild my project. If I press "Run app" this doesn't happen
ga...@google.com <ga...@google.com> #7
Re #4: This is indeed working as intended. In AGP 8.3.0 there are more validations that protect the application from runtime crashes. One such validation is to ensure that if any library/subproject that the module depends uses Java 8+ API desugaring, the consumer must have that feature enabled. Otherwise, you may hit runtime crashes.
Re #5: desugar_jdk_lib
in your final APK. In the release variant, AGP will ensure that any unused APIs from desugar_jdk_lib
are removed, so your APK will increase only because of APIs that are actually used. Hope that helps.
ti...@volvocars.com <ti...@volvocars.com> #8
Just to make sure that I understand correctly: We have some modules that need desugaring and some that don't. Since we are using convention plugins: Do you mean that adding desugaring to all modules would not be a problem? So, this doesn't increase the app size of the release APK more than enabling desugaring only for the modules that actually need it?
ga...@google.com <ga...@google.com> #9
In general, you want to avoid using it unless you actually need it ("need it" means either you need it in the current module or another module depends on a module that "needs it"). While we try to limit the build speed and APK size impact, there is still some impact, so I'd advise to keep this feature off in modules that don't use it. Alternatively, you can measure the release APK size impact and build speed impact and base your decision on that.
al...@gmail.com <al...@gmail.com> #10
In my case, my module that has desugaring enabled is used by lots of modules in my app. So what this does is that I have to essentially enable desugaring on all modules. Also, I have a module that provides test utils and libraries and is used as a testImplementation. Since it depends on a module that has desugaring enabled, I enabled desugaring for it as well but now I'm receiving the following error:
6 files found with path 'META-INF/LICENSE.md'.
Adding a packaging block may help, please refer to
https://developer.android.com/reference/tools/gradle-api/8.3/com/android/build/api/dsl/Packaging
for more information
Description
I upgraded my project to AGP 8.3.0 and desugaring stoped working. In my project I have module (x) that uses core library desugaring. Module y is dependent on x
When I compile my project I am getting error:
I am using:
AGP 8.3.0
And in module x build.gradle.kts:
All worked as expected with older versions of AGP.