忽略匿名内部类org.apache的InnerClasses属性

时间:2016-10-09 09:47:40

标签: android warnings

人。 我得到了这些错误(其中504个):

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

我把它放在了proguard

-keepattributes InnerClasses, EnclosingMethod
-dontoptimize

但是,我仍然会遇到这个错误。我用

useLibrary 'org.apache.http.legacy'
dependencies {
     compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
}

一切正常,只有在我生成apk时才会出现这些错误。但APK工作正常。我怎样才能摆脱这些错误?

1 个答案:

答案 0 :(得分:1)

将以下属性添加到pro-guard文件

-dontwarn org.apache.**
-keep class org.apache.http.** { *; }