android studio 3.1警告:规则`-keep public class *扩展了java.lang.annotation.Annotation {

问题描述:

我最近升级了android studio,但是我无法找到android studio 3.1中报告的以下问题的来源:

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 class *extends java.lang.annotation.Annotation {

警告似乎已被取消,并且缺少信息.但是它看起来像一个proguard问题,尽管在构建调试变量时收到此警告.我检查了我的proguard文件,但没有与之完全匹配的行.我搜索了整个项目.关于根本原因的任何想法吗?

the warning seems to be cut off perhaps and missing information. but it looks like a proguard issue although i am getting this warning when building debug variant. i checked my proguard files and i dont have a line that matches that exactly. i searched the entire project. any ideas on the root cause ?

如@ arcone1,@ Vincent Mattana&通过@random确认,此问题已在Android Studio 3.2中解决.

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

来自Google Issue Tracker中的问题:

From the issue in Google Issue Tracker:

为了澄清,这是来自R8的警告,而不是错误,我们使用它来计算传统multidex变体中主要dex的类列表.它不会影响输出,也不会导致构建或运行时失败.
我正在研究将此保留规则更改为"-keep public class *实现java.lang.annotation.Annotation"的方法,该方法在语义上是相同的,并删除了警告.

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.

所以,现在就暂时忽略它,或者与Canary一起流血边缘(在您自己承担风险).

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

更新: 3.2是