Android 警告 - 忽略 InnerClasses 属性(jnamed)

标签 android android-studio warnings proguard

我在 Android Studio 中构建代码时收到此警告。
它们很少会不显示,但大多数时候会显示。

warning: Ignoring InnerClasses attribute for an anonymous inner class
(jnamed$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(jnamed$2) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(jnamed$3) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.

我已经阅读了其他问题并将它们包含在我的混淆文件中:

-keepattributes EnclosingMethod
-keepattributes InnerClasses

但是他们没有帮助。

编辑:

如果无法解决这个问题,请告诉我如何在 postguard 中隐藏此警告(或任何其他方式)。谢谢!

最佳答案

是什么导致了这个问题?

您正在尝试在运行 Android 运行时 Dalvik 的 JVM 中使用未针对 Java 6 或 7 编译的类文件。这不是什么大问题,您不必担心。

我该如何解决?

您可以重新编译导致问题的库。不幸的是,该库已经在编译的 jar 中。你可以尝试在网上寻找它的源码然后编译它

关于Android 警告 - 忽略 InnerClasses 属性(jnamed),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40485997/

相关文章:

android - Firebase App Distribution 使用 gradle 上传 apk

android - 如何使图像填充RelativeLayout背景而不拉伸(stretch)

android - "Program type already present"是什么意思?

c++ - 请帮助 : [Warning] deprecated conversion from string constant to 'char*' [-Wwrite-strings]

java - 摆脱 List<GenericClass<T>>.toArray() 中的警告

c++ - 警告 :"pointless comparison of unsigned integer with zero"cuda

java - 使用 Platform Channels 在 Flutter 中调用原生库

java - 当父级不是 Activity 而是 Fragment 时,选项卡为空

java - Gradle同步问题: CreateProcess error=2

android - 输入字符串错误 : "sayısı 0x7f070042" Android Studio