11

I've been working on the newest version of my app and it tests just fine, but when I do a release ProGuard build, I get many errors, mostly about not being able to find org.apache.http.*, which I do not use in my project. I have searched my entire project for that text and cannot find it. I have added some dependencies but none which I think would use HTTP.

How do I figure out why ProGuard is complaining and address it properly? It says I can run "with --stacktrace option", but I can't figure out how to do that.

I appreciate any help, as I find ProGuard often confusing.

Build output:

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.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.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.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.analytics.internal.zzj: can't find referenced class org.apache.http.NameValuePair Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification Warning: com.google.android.gms.internal.zzac: can't find referenced class android.net.http.AndroidHttpClient Warning: com.google.android.gms.internal.zzac: can't find referenced class android.net.http.AndroidHttpClient Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.HttpEntity Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.HttpResponse Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.StatusLine Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.client.HttpClient Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.client.methods.HttpGet Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.conn.ClientConnectionManager Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.impl.client.DefaultHttpClient Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.params.BasicHttpParams Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.client.methods.HttpGet Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.impl.client.DefaultHttpClient Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.params.BasicHttpParams Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.HttpEntity Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.HttpResponse Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.HttpResponse Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.StatusLine Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.client.HttpClient Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.client.HttpClient Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.conn.ClientConnectionManager Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.client.HttpClient Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.client.HttpClient Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.client.HttpClient Warning: com.google.android.gms.internal.zzqj: can't find referenced class org.apache.http.HttpResponse Warning: com.google.android.gms.internal.zzqj: 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.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.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.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.HttpEntity 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.HttpResponse 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.StatusLine 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.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.HttpPost 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.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.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.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.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.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.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.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.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.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.entity.BasicHttpEntity 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.entity.BasicHttpEntity 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.BasicHttpResponse 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.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.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.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.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.HttpEntityEnclosingRequest 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.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.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.client.HttpClient 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 Warning: com.google.android.gms.tagmanager.zzcx: can't find referenced class org.apache.http.HttpEntityEnclosingRequest Warning: there were 148 unresolved references to classes or interfaces. You may need to add missing library jars or update their versions. If your code works fine without the missing classes, you can suppress the warnings with '-dontwarn' options. (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass) Warning: there were 2 unresolved references to program class members. Your input classes appear to be inconsistent. You may need to recompile the code. (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember) Warning: there were 1 unresolved references to library class members. You probably need to update the library versions. (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember) :GradeTrackerPro:proguardRelease FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':MyApp:proguardRelease'. > java.io.IOException: Please correct the above warnings first. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED 

From my Gradle file:

android { compileSdkVersion 23 buildToolsVersion "23" sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } // Move the tests to tests/java, tests/res, etc... instrumentTest.setRoot('tests') buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } // Move the build types to build-types/<type> // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... // This moves them out of them default location under src/<type>/... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanied // by a similar customization. debug.setRoot('build-types/debug') release.setRoot('build-types/release') } // to ignore warnings and strings not converted to all languages android { lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors are found: abortOnError false } } 

My proguard-rules.pro file:

-keep class !android.support.v7.internal.view.menu.MenuBuilder, !android.support.v7.internal.view.menu.SubMenuBuilder, android.support.v7.** { *; } -keep interface android.support.v7.** { *; } -dontwarn com.opencsv.bean.** -renamesourcefileattribute SourceFile -keepattributes SourceFile,LineNumberTable # these last two lines keep info for debugging # added these because proguard was complaining. Not sure where they could be referenced! # For Flurry -keep class com.flurry.** { *; } -dontwarn com.flurry.** -keepattributes *Annotation*, EnclosingMethod -keepclasseswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet, int) ; } # Google Play Services library -keep class * extends java.util.ListResourceBundle { protected Object[][] getContents() ; } -keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable { public static final *** NULL; } -keepnames @com.google.android.gms.common.annotation.KeepName class * -keepclassmembernames class * { @com.google.android.gms.common.annotation.KeepName *; } -keepnames class * implements android.os.Parcelable { public static final ** CREATOR; } 
3

2 Answers 2

18

I never face this issue before updating buildTool to 23.0. The only workaround that i could see with this newer version of build tools for my App was, you need to add this to your Progaurd.txt file.

-dontwarn android.support.v4.** -keep public class com.google.android.gms.* { public *; } -dontwarn com.google.android.gms.** 

If you are using Apache's Http in your project, you need to include the following lines too:

-keepnames class org.apache.** {*;} -keep public class org.apache.** {*;} -dontwarn org.apache.commons.logging.LogFactory -dontwarn org.apache.http.annotation.ThreadSafe -dontwarn org.apache.http.annotation.Immutable -dontwarn org.apache.http.annotation.NotThreadSafe 

Let me know if this helps to resolve your issue too.

Sign up to request clarification or add additional context in comments.

4 Comments

I had the same problem after 23.0 upgrade and -dontwarn com.google.android.gms.** fixed it. I didn't need the others. Thank you
@Shine Actually you need to add those other lines only if were still using the old Apache Http library for Network calls. I have further clarified in the answer. Thanks for pointing out.
Why do you need public for com.google.android.gms?
I'm still having problem with Warning:twitter4j.TwitterAPIMonitor and Warning:com.squareup.picasso how can I solve it ?
1

You have to add to your build.gradle file the following if your app uses the old apache HttpClient :

useLibrary 'org.apache.http.legacy'

as explained here: https://www.youtube.com/watch?v=yYU4DHLwoRk

1 Comment

I already put org.apache.http.legacy in my build.gradle but I still have the errors

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.