我在 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/