android studio 3.1 Warning: The rule `-keep public class *extends java.lang.annotation.Annotation {

后端 未结 11 1503
天命终不由人
天命终不由人 2021-01-31 07:48

i recently upgraded android studio but im not able to find the source of the following issue reported in android studio 3.1:

Warning: The rule `-keep public clas         


        
11条回答
  •  悲哀的现实
    2021-01-31 08:16

    class android.support.annotation.Keep is what I use (Android Studio 3.1.2) ...

    -keep @interface android.support.annotation.Keep
    -keep @android.support.annotation.Keep class *
    -keepclasseswithmembers class * {
        @android.support.annotation.Keep ;
    }
    -keepclasseswithmembers class * {
        @android.support.annotation.Keep ;
    }
    

    there are further flags to control which annotations to keep:

    -keepattributes RuntimeVisibleAnnotations
    -keepattributes AnnotationDefault
    -keepattributes *Annotation*
    

    one can get the raw output by running ./gradlew assembleRelease in the terminal tab.

    when nothing in the project's ProGuard configuration refers to Annotation, this warning might originate from the "consumer" rules of some referenced library, to be obfuscated at build time.

    hence it appears to be a harmless warning, one can possibly mute it:

    -dontwarn java.lang.annotation.Annotation
    

提交回复
热议问题