Work around incorrect R8 proguard compatibility
Proguard treats -dontobfuscate -keepattributes *Annotations* the same as -dontobufscate by keeping all attributes. R8, even in proguard compatibility mode, discards all attributes that don't match, including EnclosingClass attributes that may be necessary. Pass -keepattributes * whenever passing -dontobfuscate to make R8 act more like proguard. This isn't a complete solution, some modules may set LOCAL_PROGUARD_ENABLED := custom and then manually specify -dontobfuscate on the command line or in a flags file, in which case they will see the incorrect behavior of R8. Bug: 80081393 Test: m checkbuild Test: examine attributes on com.android.stk.BootCompletedReceiver in out/target/common/obj/APPS/Stk_intermediates/classes.dex Change-Id: I761f2d0617c5295df8fc7adfc4fd00d2aa41961e
This commit is contained in:
parent
e2d0b0cc43
commit
cf5180c198
|
@ -458,6 +458,9 @@ endif
|
|||
ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
|
||||
# By default no obfuscation
|
||||
common_proguard_flags += -dontobfuscate
|
||||
# Workaround for b/80081393: R8 discards other attributes when
|
||||
# -keepattributes *Annotations* is used, even when obfuscation is off.
|
||||
common_proguard_flags += -keepattributes '*'
|
||||
endif # No obfuscation
|
||||
ifeq ($(filter optimization,$(LOCAL_PROGUARD_ENABLED)),)
|
||||
# By default no optimization
|
||||
|
|
Loading…
Reference in New Issue