Игнорирование атрибута InnerClasses для анонимного внутреннего класса org.apache

#android #warnings

#Android #предупреждения

Вопрос:

ребята. Я получаю эти ошибки (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:

Добавьте следующие атрибуты в файл pro-guard

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

Комментарии:

1. Это решает проблему сборки выпуска, но как насчет сборки отладки?