I use this proguard file:
-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.**
But after some update on the code, I have the following errors:
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
I tried with:
-keep class org.apache.http.**
-keep interface org.apache.http.**
-dontwarn org.apache.**
But still doesn't works, what's wrong? I really don't understand what can I do. PS do you have any suggestions in order to optimize my file? Thanks in advance.
I had the same problem.
I found the answer here and it worked for me: How to add Apache HTTP API (legacy) as compile-time dependency to build.grade?
In your top level build.gradle file add:
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
}
}
...
In your app-specific build.gradle file add:
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
useLibrary 'org.apache.http.legacy'
...
}
Hope it works for you! it works now with ProGuard on. I had the exact same problem as you.
It looks like the warning comes from the google library, have you tried something like that:
-dontwarn com.google.android.gms.**
-keep class com.google.android.gms.**
I would also try without the dontwarn
cause I would assume you want to be warned if there is something to be warned about!
In Eclipse find org.apache.http.legacy.jar in ..sdk/platforms/android-23/optional.
Import it like external jar, check order/export and in proguard type:
-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.**
Add following lines in your proguard file.
-keep class org.apache.http.** { *; }
-keep class org.apache.** { *; }
-dontwarn org.apache.**
-dontwarn org.apache.http.**
-dontwarn org.apache.commons.**
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With