Android 编译期间的“忽略内部类属性”警告输出是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3308010/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the "Ignoring InnerClasses attribute" warning output during compilation?
提问by RMK
I am new to Android and am using the Ical4j
library for parsing ICS (Outlook calendar) files.
我是 Android 新手,正在使用该Ical4j
库来解析 ICS(Outlook 日历)文件。
However, when I build my application in Eclipse, the following warning appears many times in the console:
但是,当我在 Eclipse 中构建应用程序时,控制台中多次出现以下警告:
[2010-07-22 15:58:31 - Google Calendar Upload] warning: Ignoring InnerClasses attribute for an anonymous inner class that doesn't come with an associated EnclosingMethod attribute. (This class was probably produced by a broken compiler.)
[2010-07-22 15:58:31 - Google Calendar Upload] 警告:忽略不带有关联 EnclosureMethod 属性的匿名内部类的 InnerClasses 属性。(这个类可能是由一个损坏的编译器生成的。)
Which implications does this have? How can I resolve this?
这有哪些影响?我该如何解决这个问题?
采纳答案by Nick
This is quite common when including jar files. Although the warning isn't anything to worry about if you are just using the API normally, you should be able to get rid of them by compiling ical4j yourself from source within Eclipse (either build a new jar, or just drop the source into your own source folder). Though I should stress that unless you actually get problems, this isn't something to worry about.
这在包含 jar 文件时很常见。尽管如果您只是正常使用 API,则无需担心警告,但您应该能够通过在 Eclipse 中自己从源代码编译 ical4j 来摆脱它们(构建一个新的 jar,或者只是将源放入您的自己的源文件夹)。虽然我应该强调,除非你真的遇到问题,否则这不是什么值得担心的。
回答by William
If your app and your libraries have all been built with a new JDK (7+) and you are still getting this, then you can fix this problem by telling Proguard to keep the enclosing method attribute. Just add the following to your Proguard rules:
如果您的应用程序和库都是使用新的 JDK (7+) 构建的,并且您仍然遇到此问题,那么您可以通过告诉 Proguard 保留封闭方法属性来解决此问题。只需将以下内容添加到您的 Proguard 规则中:
-keepattributes EnclosingMethod
-keepattributes EnclosingMethod
回答by Dominik Mohr
I had the same error when using ksoap2 library.
使用 ksoap2 库时我遇到了同样的错误。
To get rid of it I downloaded DJ Java Decompilerto decompile the .jar file to .java files. After that i compiled the .java files to a .jar file using eclipse.
为了摆脱它,我下载了DJ Java Decompiler将 .jar 文件反编译为 .java 文件。之后,我使用 Eclipse 将 .java 文件编译为 .jar 文件。
回答by kreker
Update build tools and support libraries to the same version
将构建工具和支持库更新到相同版本