Intereting Posts
Как реализовать обрезку видео на Android, например instagram или Whatsapp? Действия, которые не выполнялись для обработки Intent при отправке электронной почты Изменение значка меню ActionBar в зависимости от стиля Как работает детектор функций ORCV ORB? Android SupportLib – FrameLayout в CoordinatorLayout с AppBarLayout, потребляющим всю высоту экрана В Google Plus дважды появляется диалоговое окно «Выбрать учетную запись» Горизонтальный LinearLayout с несколькими детьми, перемещение детей ниже на новой линии, когда больше нет горизонтального пространства Android.support.v7.widget.RecyclerView не удалось создать экземпляр Как использовать один класс SyncAdapter для нескольких полномочий? Кордоба-платформа add android дает ошибку: «Ошибка: предоставленный путь не является проектом Android». Android-эмулятор не будет монтировать SD-карту Как сохранить пробелы в конце и / или в начале строки? Как разобрать URL-адрес из строки в Android? Как CursorLoader автоматически обновляет представление, даже если приложение неактивно? Единичные тесты с JUnit + (Robolectric или Mockito или оба в Android)

Proguard и ошибка

Я использую этот файл proguard:

-dontskipnonpubliclibraryclasses -dontskipnonpubliclibraryclassmembers !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/* -optimizationpasses 10 -allowaccessmodification -mergeinterfacesaggressively -overloadaggressively -assumenosideeffects class android.util.Log { *; } -keep public class * extends android.app.Activity -keep public class * extends android.app.Application -keep public class * extends android.app.Service -keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.content.ContentProvider -keep public class * extends android.app.backup.BackupAgent -keep public class * extends android.preference.Preference -keep public class * extends android.support.v4.app.Fragment -keep public class * extends android.support.v4.app.DialogFragment -keep public class * extends com.actionbarsherlock.app.SherlockListFragment -keep public class * extends com.actionbarsherlock.app.SherlockFragment -keep public class * extends com.actionbarsherlock.app.SherlockFragmentActivity -keep public class * extends android.app.Fragment -keep public class com.android.vending.licensing.ILicensingService -keep public class org.jsoup.** { public *; } -keep public class * extends android.view.View { public <init>(android.content.Context); public <init>(android.content.Context, android.util.AttributeSet); public <init>(android.content.Context, android.util.AttributeSet, int); public void set*(...); } -keepclasseswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclasseswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet, int); } -keepclassmembers class * extends android.app.Activity { public void *(android.view.View); } -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } -keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; } -keepclassmembers class **.R$* { public static <fields>; } -keep class android.support.v4.app.** { *; } -keep interface android.support.v4.app.** { *; } -keep class com.actionbarsherlock.** { *; } -keep interface com.actionbarsherlock.** { *; } -keep class com.google.ads.** {*;} -keep class com.google.ads.internal.** {*;} -keep class com.google.ads.mediation.** {*;} -keep class com.google.ads.mediation.adfonic.** {*;} -keep class com.google.ads.mediation.admob.** {*;} -keep class com.google.ads.mediation.adfonic.util.** {*;} -keep class com.google.ads.mediation.customevent.** {*;} -keep class com.google.ads.searchads.** {*;} -keep class com.google.ads.util.** {*;} -dontwarn android.support.** -dontwarn com.google.ads.** 

Но после некоторого обновления кода я обнаружил следующие ошибки:

 Warning:com.google.android.gms.internal.zzw$zza: can't find superclass or interface org.apache.http.client.methods.HttpEntityEnclosingRequestBase Warning:com.google.android.gms.analytics.internal.zzam: can't find referenced class org.apache.http.NameValuePair Warning:com.google.android.gms.analytics.internal.zzam: can't find referenced class org.apache.http.client.utils.URLEncodedUtils Warning:com.google.android.gms.analytics.internal.zzam: can't find referenced class org.apache.http.NameValuePair Warning:com.google.android.gms.analytics.internal.zzj: can't find referenced class org.apache.http.NameValuePair Warning:com.google.android.gms.analytics.internal.zzj: can't find referenced class org.apache.http.client.utils.URLEncodedUtils Warning:com.google.android.gms.analytics.internal.zzj: can't find referenced class org.apache.http.NameValuePair Warning:com.google.android.gms.internal.zzac: can't find referenced class android.net.http.AndroidHttpClient Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.HttpEntity Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.HttpResponse Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.StatusLine Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.client.HttpClient Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.client.methods.HttpGet Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.conn.ClientConnectionManager Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.impl.client.DefaultHttpClient Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.params.BasicHttpParams Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.client.methods.HttpGet Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.impl.client.DefaultHttpClient Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.params.BasicHttpParams Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.HttpEntity Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.HttpResponse Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.StatusLine Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.client.HttpClient Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.conn.ClientConnectionManager Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.client.HttpClient Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.HttpResponse Warning:com.google.android.gms.internal.zzqt: can't find referenced class org.apache.http.client.HttpClient Warning:com.google.android.gms.internal.zzt: can't find referenced class org.apache.http.Header Warning:com.google.android.gms.internal.zzt: can't find referenced class org.apache.http.HttpEntity Warning:com.google.android.gms.internal.zzt: can't find referenced class org.apache.http.HttpResponse Warning:com.google.android.gms.internal.zzt: can't find referenced class org.apache.http.StatusLine Warning:com.google.android.gms.internal.zzt: can't find referenced class org.apache.http.impl.cookie.DateUtils Warning:com.google.android.gms.internal.zzt: can't find referenced class org.apache.http.Header Warning:com.google.android.gms.internal.zzt: can't find referenced class org.apache.http.HttpEntity Warning:com.google.android.gms.internal.zzt: can't find referenced class org.apache.http.HttpResponse Warning:com.google.android.gms.internal.zzt: can't find referenced class org.apache.http.StatusLine Warning:com.google.android.gms.internal.zzt: can't find referenced class org.apache.http.HttpEntity Warning:com.google.android.gms.internal.zzt: can't find referenced class org.apache.http.Header Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.HttpClient Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpDelete Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpEntityEnclosingRequestBase Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpGet Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpHead Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpOptions Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpPost Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpPut Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpTrace Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpUriRequest Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.entity.ByteArrayEntity Warning:com.google.android.gms.internal.zzw: can't find referenced method 'void addHeader(java.lang.String,java.lang.String)' in program class com.google.android.gms.internal.zzw$zza Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpDelete Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpEntityEnclosingRequestBase Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpGet Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpHead Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpOptions Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpPost Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpPut Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpTrace Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.entity.ByteArrayEntity Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.HttpClient Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpUriRequest Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.HttpClient Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpUriRequest Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.HttpResponse Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpUriRequest Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpEntityEnclosingRequestBase Warning:com.google.android.gms.internal.zzw: can't find referenced class org.apache.http.client.methods.HttpUriRequest Warning:com.google.android.gms.internal.zzw$zza: can't find referenced class org.apache.http.client.methods.HttpEntityEnclosingRequestBase Warning:com.google.android.gms.internal.zzw$zza: can't find referenced method 'void setURI(java.net.URI)' in program class com.google.android.gms.internal.zzw$zza Warning:com.google.android.gms.internal.zzw$zza: can't find referenced class org.apache.http.client.methods.HttpEntityEnclosingRequestBase Warning:com.google.android.gms.internal.zzx: can't find referenced class org.apache.http.impl.cookie.DateParseException Warning:com.google.android.gms.internal.zzx: can't find referenced class org.apache.http.impl.cookie.DateUtils Warning:com.google.android.gms.internal.zzy: can't find referenced class org.apache.http.HttpResponse Warning:com.google.android.gms.internal.zzz: can't find referenced class org.apache.http.ProtocolVersion Warning:com.google.android.gms.internal.zzz: can't find referenced class org.apache.http.entity.BasicHttpEntity Warning:com.google.android.gms.internal.zzz: can't find referenced class org.apache.http.message.BasicHeader Warning:com.google.android.gms.internal.zzz: can't find referenced class org.apache.http.message.BasicHttpResponse Warning:com.google.android.gms.internal.zzz: can't find referenced class org.apache.http.message.BasicStatusLine Warning:com.google.android.gms.internal.zzz: can't find referenced class org.apache.http.ProtocolVersion Warning:com.google.android.gms.internal.zzz: can't find referenced class org.apache.http.entity.BasicHttpEntity Warning:com.google.android.gms.internal.zzz: can't find referenced class org.apache.http.message.BasicHeader Warning:com.google.android.gms.internal.zzz: can't find referenced class org.apache.http.message.BasicHttpResponse Warning:com.google.android.gms.internal.zzz: can't find referenced class org.apache.http.message.BasicStatusLine Warning:com.google.android.gms.internal.zzz: can't find referenced class org.apache.http.HttpResponse Warning:com.google.android.gms.internal.zzz: can't find referenced class org.apache.http.HttpEntity Warning:com.google.android.gms.tagmanager.zzby: can't find referenced class org.apache.http.impl.client.DefaultHttpClient Warning:com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.Header Warning:com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.HttpEntity Warning:com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.HttpEntityEnclosingRequest Warning:com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.HttpHost Warning:com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.HttpResponse Warning:com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.StatusLine Warning:com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.client.ClientProtocolException Warning:com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.client.HttpClient Warning:com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.message.BasicHttpEntityEnclosingRequest Warning:com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.HttpHost Warning:com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.message.BasicHttpEntityEnclosingRequest Warning:com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.HttpEntity Warning:com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.HttpEntityEnclosingRequest Warning:com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.HttpResponse Warning:com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.StatusLine Warning:com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.client.HttpClient Warning:com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.HttpEntityEnclosingRequest 

Я попробовал:

 -keep class org.apache.http.** -keep interface org.apache.http.** -dontwarn org.apache.** 

Но все равно не работает, что случилось? Я действительно не понимаю, что я могу сделать. PS У вас есть предложения по оптимизации моего файла? Заранее спасибо.

Solutions Collecting From Web of "Proguard и ошибка"

У меня такая же проблема.

Я нашел ответ здесь, и это сработало для меня: как добавить HTTP API Apache (legacy) в качестве времени компиляции для build.grade?

В файле верхнего уровня build.gradle добавьте:

 buildscript { ... dependencies { classpath 'com.android.tools.build:gradle:1.3.1' } } ... 

В вашем файле build.gradle, специфичном для приложения, добавьте:

 android { compileSdkVersion 23 buildToolsVersion "23.0.0" useLibrary 'org.apache.http.legacy' ... } 

Надеюсь, это сработает для вас! Теперь он работает с ProGuard. У меня была такая же проблема, как и вы.

Похоже, предупреждение появляется из библиотеки google, вы пробовали что-то вроде этого:

 -dontwarn com.google.android.gms.** -keep class com.google.android.gms.** 

Я бы тоже попробовал без dontwarn потому что предполагаю, что вы хотите, чтобы вас предупреждали, если о чем-то нужно предупредить!

В Eclipse найдите org.apache.http.legacy.jar в ..sdk / platform / android-23 / optional.

Импортируйте его как внешнюю банку, проверьте порядок / экспорт и тип proguard:

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