Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Example messages
warning XA4322: Skipping library ProGuard configuration file 'obj/Debug/net10.0-android/lp/0/jl/proguard.txt' (from NuGet package 'Acme.SomeLibrary' 1.2.3) because it contains the unsupported global option '-printmapping'. Global ProGuard options are only allowed in application projects.
Issue
An Android library (.aar) shipped a proguard.txt file (a "consumer ProGuard
configuration") that contains a global ProGuard option such as -dontoptimize,
-dontobfuscate, -printmapping, -printconfiguration, -printusage,
-printseeds, or -dump.
These options control the entire build (for example, where R8 writes the
mapping file) and must only be set by the application project that consumes the
library. They are not allowed inside an .aar's proguard.txt. This matches
the behavior introduced in Android Gradle Plugin 9.0,
where R8 either fails library publishing or silently ignores such global
options when they appear in a pre-compiled dependency (JAR or AAR). To keep
your build working, .NET for Android skips the entire offending file before
invoking R8 and emits this warning.
Solution
If you own the library, remove the global options from its proguard.txt /
ProguardConfiguration items and instead set them in the application project's
own ProguardConfiguration (for example, by setting
$(AndroidProguardMappingFile) to control where the mapping file is written).
Once the global options are removed, the library's keep rules will once again
be passed to R8.
If you do not own the library, file an issue with its maintainers and ask them
to remove the disallowed options. Until then, R8 will not see any of the keep
rules from this library's proguard.txt, which may cause needed code to be
shrunk. Add equivalent -keep rules to your own application's
ProguardConfiguration as a workaround.