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

后端 未结 11 1487
天命终不由人
天命终不由人 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:37

    My gradle version was the issue i upgraded to com.android.tools.build:gradle:3.3.2 and the error disappeared.

    0 讨论(0)
  • 2021-01-31 08:38

    In my case the warning appeared after changing Gradle version. Once I invalidated cache & restarted Android Studio the warning disappeared.

    From the menu: File > Invalidate caches & restart

    invalidate caches & restart

    0 讨论(0)
  • 2021-01-31 08:39

    As mentioned in the question's comments by @arcone1, @Vincent Mattana & confirmed by @random, the issue is resolved in Android Studio 3.2.

    From the issue in Google Issue Tracker:

    To clarify, this is a warning, not an error, from R8, which we use to compute the list of classes for the main dex, in legacy multidex variant. It does not affect the output, and it should not cause build nor runtime failures.
    I am working on a fix to change this keep rule to "-keep public class * implements java.lang.annotation.Annotation", which is semantically the same, and removes the warning.

    So, just ignore it for now or go bleeding edge with Canary (tread at your own risk).

    UPDATE: 3.2 is out!

    0 讨论(0)
  • 2021-01-31 08:41
    1. open build.gradle file.
    2. remove “multiDexEnabled true”.
    3. rebuild app.
    0 讨论(0)
  • 2021-01-31 08:42

    Gradle version: 3.1.4

    MultiDex: Enabled

    In my case, I forgot to add translation for some string resources. No error/warning after adding.

    0 讨论(0)
提交回复
热议问题