Export to GitHub

android-developer-preview - issue #3001

PlayServices problems with proguard


Posted on Aug 19, 2015 by Helpful Dog

When trying to compile in release an app with google play services reference proguard fails because of errors like

Unexpected error while performing partial evaluation: Class = [com/google/android/gms/internal/zzw] Method = [zza(Lcom/google/android/gms/internal/zzk;Ljava/util/Map;)Lorg/apache/http/HttpResponse;] Exception = [java.lang.IllegalArgumentException] (Can't find common super class of [com/google/android/gms/internal/zzk] (with 2 known super classes) and [com/google/android/gms/internal/zzw$zza] (with 1 known super classes))

This is due to missing apache http client in android 6 As a workaround -dontwarn com.google.android.gms.*

seems to work

Comment #1

Posted on Aug 19, 2015 by Quick Dog

Same here, relevant gradle config:

dependencies { compile 'com.google.android.gms:play-services-analytics:7.8.0' }

android { compileSdkVersion 23 buildToolsVersion "23.0.0" defaultConfig { minSdkVersion 15 targetSdkVersion 23 } }

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

Comment #2

Posted on Aug 20, 2015 by Massive Elephant

(No comment was entered for this change.)

Comment #3

Posted on Aug 20, 2015 by Massive Elephant

Hi, Thank you for reporting this issue. For us to be able to investigate this issue it would be helpful if you could provide the following additional information:

Android build Which Android build are you using? (e.g. KVT49L)

Device used Which device did you use to reproduce this issue?

logcat output See http://developer.android.com/tools/help/logcat.html. Copy and paste relevant sections of the logcat output into this issue.

Android bug report After reproducing the issue, press the volume up, volume down, and power buttons simultaneously. This will capture a bug report on your device in the “bug reports” directory. Attach this file to this issue.

Alternate method: After reproducing the issue, navigate to developer settings, ensure ‘USB debugging’ is enabled, then enable ‘Bug report shortcut’. To take bug report, hold the power button and select the ‘Take bug report’ option.

Comment #4

Posted on Aug 20, 2015 by Helpful Dog
  • Which version of the SDK are you using? 24.3.4

  • Which Android build are you using? (e.g. MPA44G) MRA44C

  • What device are you using? Not relevant, is an error when compiling

Logcat is not relevant since it's an error when compiling. This is console output

Proguard returned with error code 1. See console 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 class android.app.Notification Warning: com.google.android.gms.gcm.zza: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in 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.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.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.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.client.HttpClient 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.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 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 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 You should check if you need to specify additional program jars. Warning: there were 148 unresolved references to classes or interfaces. You may need to specify additional library jars (using '-libraryjars'). Warning: there were 4 unresolved references to program class members. Your input classes appear to be inconsistent. You may need to recompile them and try again. Alternatively, you may have to specify the option '-dontskipnonpubliclibraryclassmembers'. java.io.IOException: Please correct the above warnings first. at proguard.Initializer.execute(Initializer.java:321) at proguard.ProGuard.initialize(ProGuard.java:211) at proguard.ProGuard.execute(ProGuard.java:86) at proguard.ProGuard.main(ProGuard.java:492)

Comment #5

Posted on Aug 21, 2015 by Happy Monkey

We're getting this as well. A little annoying to see that response though, it's very clearly a compilation problem, none of the requested information is relevant.

Play services is using apache http stuff still despite Marshmellow no longer including it, which is surprising since this was announced a long time ago.

Comment #6

Posted on Aug 21, 2015 by Happy Monkey

Another workaround I just found on reddit:

"Including "android { useLibrary 'org.apache.http.legacy' }" in your build.gradle should allow you to continue using dependencies that rely on apache http"

Comment #7

Posted on Aug 21, 2015 by Massive Elephant

Issue 2969 has been merged into this issue.

Comment #8

Posted on Aug 21, 2015 by Massive Elephant

We have passed this on to the development team and will update this issue with more information as it becomes available.

Comment #9

Posted on Aug 21, 2015 by Happy Rabbit

Maybe can add Apache manually until Google not resolve this problems ?

Comment #10

Posted on Aug 22, 2015 by Quick Lion

Even lvl and volley libraries have this problem. It's really unbelievable that it's Google that use deprecated code!! Update these libraries NOW! About the workaround: the use library gradle tricks works (even if for some reason Android Studio gives error at sorce code level but it compiles, crazy) however it's just a workaround and not a solution for the future, so Google MUST update these libraries.

Comment #11

Posted on Aug 22, 2015 by Happy Monkey

@ ua.and: you can include the legacy library, but beware as it ads APK size bloat.

Comment #12

Posted on Aug 22, 2015 by Happy Monkey

Ignoring the warnings and keeping the play services classes doesn't make a difference for us. Play services is already obfuscated, so there's nothing to keep. We are totally unable to build with proguard obfuscation for the time being.

Unexpected error while performing partial evaluation: Class = [com/google/android/gms/internal/zzw] Method = [zza(Lcom/google/android/gms/internal/zzk;Ljava/util/Map;)Lorg/apache/http/HttpResponse;] Exception = [java.lang.IllegalArgumentException] (Can't find common super class of [com/google/android/gms/internal/zzk] (with 2 known super classes) and [com/google/android/gms/internal/zzw$zza] (with 1 known super classes)) Exception while processing task java.lang.IllegalArgumentException: Can't find common super class of [com/google/android/gms/internal/zzk] (with 2 known super classes) and [com/google/android/gms/internal/zzw$zza] (with 1 known super classes) at proguard.evaluation.value.TypedReferenceValue.findCommonClass(TypedReferenceValue.java:441) at proguard.evaluation.value.TypedReferenceValue.generalize(TypedReferenceValue.java:277) at proguard.evaluation.value.TypedReferenceValue.generalize(TypedReferenceValue.java:201) at proguard.evaluation.value.ReferenceValue.generalize(ReferenceValue.java:298) at proguard.evaluation.Variables.generalize(Variables.java:136) at proguard.evaluation.TracedVariables.generalize(TracedVariables.java:118) at proguard.optimize.evaluation.PartialEvaluator.evaluateSingleInstructionBlock(PartialEvaluator.java:690) at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlock(PartialEvaluator.java:609) at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlockAndExceptionHandlers(PartialEvaluator.java:567) at proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute0(PartialEvaluator.java:271) at proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute(PartialEvaluator.java:188) at proguard.optimize.info.ParameterUsageMarker.visitCodeAttribute(ParameterUsageMarker.java:176) at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101) at proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:81) at proguard.optimize.info.ParameterUsageMarker.visitProgramMethod(ParameterUsageMarker.java:136) at proguard.optimize.OptimizationInfoMemberFilter.visitProgramMethod(OptimizationInfoMemberFilter.java:81) at proguard.classfile.ProgramMethod.accept(ProgramMethod.java:73) at proguard.classfile.ProgramClass.methodsAccept(ProgramClass.java:516) at proguard.classfile.visitor.AllMethodVisitor.visitProgramClass(AllMethodVisitor.java:47) at proguard.classfile.ProgramClass.accept(ProgramClass.java:358) at proguard.classfile.ClassPool.classesAccept(ClassPool.java:124) at proguard.optimize.Optimizer.execute(Optimizer.java:421) at proguard.ProGuard.optimize(ProGuard.java:328) at proguard.ProGuard.execute(ProGuard.java:127) at proguard.gradle.ProGuardTask.proguard(ProGuardTask.java:1074) at com.android.build.gradle.tasks.AndroidProGuardTask.doMinification(AndroidProGuardTask.java:139) at com.android.build.gradle.tasks.AndroidProGuardTask$1.run(AndroidProGuardTask.java:115) at com.android.builder.tasks.Job.runTask(Job.java:48) at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41) at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:227) at java.lang.Thread.run(Thread.java:745)

Comment #13

Posted on Aug 26, 2015 by Massive Wombat

It seems like the apache library is still present in current marshmallow images (tried on an AVD). On the long term it would be dangerous to rely on this fact, but for the time being apps depending on libraries like volley or play services can be compiled ignoring the missing apache references. More dangerous but lighter than packaging the whole apache http library.

For reference these are the warnings I had to ignore for one app using volley and play services: -dontwarn org.apache.http.** -dontwarn android.net.http.AndroidHttpClient -dontwarn com.google.android.gms.** -dontwarn com.android.volley.toolbox.** .

Comment #14

Posted on Aug 28, 2015 by Happy Panda

I think the problem is not about a proguard warning but the reference to deprecated class or package. If it's true that next Android version will completely remove org.apache, our apps using the latest play service version will simply does not work. The workaround is useless

Comment #15

Posted on Aug 30, 2015 by Quick Rabbit

Ok, so we have two problems here: 1. PlayServices problems with proguard (issue title). Just adding the following rules to proguard fixes the problem by now: -keep class com.google.android.gms.** { ; } -dontwarn com.google.android.gms.*

  1. Google Play Licensing not compiling, due to deprecated Apache libraries (merged from 2969). 183116 should be merged then too. Errors in APKExpansionPolicy.java & ServerManagedPolicy.java. Both related to the following imports: import org.apache.http.NameValuePair; import org.apache.http.client.utils.URLEncodedUtils;

The workaround for 2 implies more changes: - Adding compile 'org.apache.httpcomponents:httpmime:4.5' to your dependencies and using MultipartEntity instead NameValuePair - Write your own class for "URLUtils". e.g. look for StackOverflow post named "Lvl library and android marshmallow" from user greywolf82 (I didn't try this one yet)

Comment #16

Posted on Aug 31, 2015 by Happy Dog

Please give Urlutils ...

Comment #17

Posted on Sep 3, 2015 by Helpful Bear

Comment deleted

Comment #18

Posted on Sep 4, 2015 by Quick Hippo

Seems google prefers ads and not lvl ^^

Comment #19

Posted on Sep 9, 2015 by Happy Giraffe

No correction yet ?

Comment #20

Posted on Sep 17, 2015 by Happy Elephant

Comment deleted

Comment #21

Posted on Sep 17, 2015 by Quick Hippo

There won't be a fix... As a Würgaround for Eclips you could add platforms/android-23/optional/org.apache.http.legacy.jar to libs

Comment #22

Posted on Sep 22, 2015 by Massive Horse

I'm running into the issue with Google Play Services, proguard, and SDK 23 as well. Adding the lines

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

appears to "fix" the issue, but is this really safe for production?

Comment #23

Posted on Sep 22, 2015 by Massive Horse

Actually, I just discovered that this issue does not occur if I use the Android Gradle Plugin 1.3.1. I was using the Android Gradle Plugin 1.4.0-beta2 before. After switching to 1.3.1 and removing the previously mentioned proguard lines I am able to use Google Play Services with SDK 23 and proguard.

So, this appears to be an issue when the following are used together:

Android Gradle Plugin 1.4.0-beta2 compileSdkVersion 23 buildToolsVersion "23.0.1" Google Play Services 7.8.0 Proguard

Comment #24

Posted on Sep 23, 2015 by Happy Elephant

Comment deleted

Comment #25

Posted on Oct 1, 2015 by Happy Ox

Using Google Play Services 8.1.0 avoids a lot of these warnings, but not all of them. I'm still getting these:

Warning:com.google.android.gms.internal.zzac: can't find referenced class android.net.http.AndroidHttpClient 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$zza: can't find referenced method 'void setURI(java.net.URI)' in program class com.google.android.gms.internal.zzw$zza

I'm using the following:

Gradle Plugin 1.3.1 compileSdkVersion 23 buildToolsVersion "23.0.1"

So it looks like it's almost solved. I'm ignoring the warnings for the moment, but I'm not sure it's the safest solution.

Comment #26

Posted on Oct 1, 2015 by Quick Rabbit

The only way finally, due to LVL is still using org.apache.http.*, is using the Google legacy recommendation you can see in [1]

To use it, you have to add it using "useLibrary" and not compile 'org.apache.http.legacy' (it's a compile-time dependency) android{ // blablabla your stuff useLibrary 'org.apache.http.legacy' }

[1] https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-apache-http-client

As an official workaround it's ok... but please Google, update soon LVL...

Comment #27

Posted on Oct 4, 2015 by Helpful Bear

Comment deleted

Comment #28

Posted on Oct 4, 2015 by Helpful Bear

Comment deleted

Comment #29

Posted on Oct 4, 2015 by Helpful Bear

I couldn't get the official workaround to work. It created an unusable APK. I removed decodeExtras(...) from APKExpansionPolicy & ServerManagedPolicy and replaced it with this (on ServerManagedPolicy).

protected static Map<String, String> decodeExtras(final String extras) {
    final Uri uri = Uri.parse('?' + extras);
    final Set<String> keySet = uri.getQueryParameterNames();
    final HashMap<String, String> results = new HashMap<>(keySet.size());

    for (final String key : keySet) {
        final List<String> valueList = uri.getQueryParameters(key);
        results.put(key, valueList.get(0));
        for (int i=1;i<valueList.size();i++) {
            results.put(key + i, valueList.get(i));
        }
    }
    return results;
}

A few notes: 1. The code is slightly different in each class. This emulates the version in APKExpansionPolicy. 2. In my local testing nothing was being passed as extras for ServerManagedPolicy 3. This has not been production tested!!!

Comment #30

Posted on Oct 4, 2015 by Grumpy Kangaroo

Comment deleted

Comment #31

Posted on Oct 4, 2015 by Grumpy Kangaroo

This thread keeps growing. There are 2 work arounds:

  1. Use Proguard:

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

  1. Or simply add the library back into your app:

android { useLibrary 'org.apache.http.legacy' }

Comment #32

Posted on Oct 6, 2015 by Massive Elephant

(No comment was entered for this change.)

Comment #33

Posted on Oct 6, 2015 by Quick Hippo

Great, after releasing Android6 noticing there are still some things to do

Comment #34

Posted on Oct 6, 2015 by Swift Rabbit

@33 Keep cool this is a library issue. IMHO nothing at all about Android M directly. However on the ASOP bug tracker my ticket was closed and it was dublicated here.

The point is that the PlayServices needs to been fixed, which seems to be almost done. Just that lvl seems not to work right now. However here are multiple workarounds which work fine.

Comment #35

Posted on Oct 20, 2015 by Massive Elephant

The development team has fixed the issue that you have reported and it will be available in a future build.

Workaround for time being: Right the issue is that you need to put the useLibrary element if you need to compile against it. But if you don't compile your code against it but you have 3rd party libs that use it and you run through proguard (Which is picky about wanting to see all the classes that are used), then we need to pass it to proguard whether you ask for it for compiling or not.

The short term work-around is to ask for the library for compiling (which will then also add it to the classpath that we give to proguard).

Comment #36

Posted on Oct 20, 2015 by Quick Dog

Can you please clarify your workaround? Give specific code snippets. The prose posted is somewhat hard to understand.

Comment #37

Posted on Oct 20, 2015 by Grumpy Kangaroo

@36 see #31

I am able to do simply do -dontwarn com.google.android.gms.**.

Comment #38

Posted on Oct 20, 2015 by Quick Dog

@37, I want the official workaround specified by Google (i.e. dnaga...@google.com). I have things seemingly working already, but dnaga... should provide a very specific workaround until the fix is released.

Comment #39

Posted on Oct 20, 2015 by Grumpy Kangaroo

@38 Google never gives "official" work arounds.

Comment #40

Posted on Oct 21, 2015 by Quick Hippo

@39 Google does not give a f...

Comment #41

Posted on Oct 24, 2015 by Swift Bird

Error after using Prograd

10-24 13:59:27.004 5493-5493/? E/AndroidRuntime: FATAL EXCEPTION: main java.lang.NullPointerException at com.infostring.quotes.c.h.onCreateView(Unknown Source) at android.support.v4.app.Fragment.performCreateView(Unknown Source) at android.support.v4.app.aa.a(Unknown Source) at android.support.v4.app.aa.a(Unknown Source) at android.support.v4.app.f.run(Unknown Source) at android.support.v4.app.aa.f(Unknown Source) at android.support.v4.app.aa.b(Unknown Source) at android.support.v4.app.aj.a(Unknown Source) at android.support.v4.view.ViewPager.a(Unknown Source) at android.support.v4.view.ViewPager.b(Unknown Source) at android.support.v4.view.ViewPager.onMeasure(Unknown Source) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814) at android.support.design.widget.CoordinatorLayout.a(Unknown Source) at android.support.design.widget.CoordinatorLayout.onMeasure(Unknown Source) at android.view.View.measure(View.java:15172) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:617) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:399) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.support.v7.internal.widget.ContentFrameLayout.onMeasure(Unknown Source) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1390) at android.widget.LinearLayout.measureVertical(LinearLayout.java:681) at android.widget.LinearLayout.onMeasure(LinearLayout.java:574) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1390) at android.widget.LinearLayout.measureVertical(LinearLayout.java:681) at android.widget.LinearLayout.onMeasure(LinearLayout.java:574) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2148) at android.view.View.measure(View.java:15172) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1848) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1100) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1273) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:998) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4212) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725) at android.view.Choreographer.doCallbacks(Choreographer.java:555) at android.view.Choreographer.doFrame(Choreographer.java:525) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4745) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method)

Progard File i added :

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

and

build.gradle

dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:23.1.0' compile 'com.android.support:design:23.1.0' compile 'com.android.support:recyclerview-v7:23.1.0' compile 'com.android.support:cardview-v7:23.1.0' compile 'com.google.android.gms:play-services-ads:8.1.0' compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4' }

Comment #42

Posted on Oct 31, 2015 by Happy Hippo

I have the same issue here after upgrade to api23. But most the solution here is for android studio gradle, what about for eclipse please? I've tried to include

-dontwarn com.google.gms.** -dontwarn org.apache.**

It export no error, but then the apk run error on phone. While if i compile and run directly using USB cable to phone everything run well. Please help

Comment #43

Posted on Oct 31, 2015 by Happy Hippo

I saw the status is fixed? How? I still face it today after upgrade to api23...

Comment #44

Posted on Oct 31, 2015 by Happy Hippo

The solution using -dontwarn com.google.android.gms.* does not work, well it export ok no proguard error, but then the result apk run error

Comment #45

Posted on Nov 1, 2015 by Grumpy Wombat

Comment deleted

Comment #46

Posted on Nov 1, 2015 by Grumpy Wombat

Comment deleted

Comment #47

Posted on Nov 1, 2015 by Grumpy Kangaroo

Comment deleted

Comment #48

Posted on Nov 1, 2015 by Grumpy Kangaroo

Comment deleted

Comment #49

Posted on Nov 1, 2015 by Grumpy Kangaroo

@44 What is not working? Post your error here or what you have tried.

See my original post @31.

There are 2 work arounds:

  1. Use Proguard with API 23:

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

or

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

  1. Or simply add the library back into your app with API 23:

android { useLibrary 'org.apache.http.legacy' }

For my apps, I am simply using '-dontwarn com.google.android.gms.**', targeting API 23.

It is hard to give a "1 solution for all" as we all all use different dependencies.

Comment #50

Posted on Nov 5, 2015 by Happy Ox

The issue still hasn't been fixed in Google Play Services 8.3.0

Comment #51

Posted on Nov 23, 2015 by Swift Kangaroo

Google recommended that we implement licensing by copying over the library and modifying the policy code to suit our particular needs. It would be helpful to have a documented upgrade path from legacy licensing code to API 23. Better yet, why not release the licensing library classes upgraded to use something other than org.apache.http?

Comment #52

Posted on Nov 25, 2015 by Grumpy Wombat

Comment deleted

Comment #53

Posted on Nov 26, 2015 by Grumpy Lion

They half fixed it. They were so eager to remove the apache http library yet forgot to update their own.

Comment #54

Posted on Nov 26, 2015 by Massive Giraffe

I solved (or hidden?) the proguard warnings without additional -keep or -dontwarn but with this line in proguard-project.txt under Eclipse: -libraryjars "\platforms\android-23\optional\org.apache.http.legacy.jar"

Then the .apk is generated. Not yet tried to run it on a device or emulator - will it run or crash ... according to #13 it should be ok.

Note: initially done for google-play-services_lib in version 7.8.95, and still necessary for version 8.2.98.

Comment #55

Posted on Dec 18, 2015 by Happy Rabbit

I have posted it somewhere else, but I thought it might help someone here too.

After spending days on the subject, I managed to solve it finally. Unfortunately we need it if we want to use expansion files. The solution has been provided by a few people here, but for me the answers were missing a few minor detail that could have saved a lot of time for me. Here is the sequence of events for novices like me to save your precious time.

First I imported the "library" folder from D:\Users\Imre\AppData\Local\Android\sdk1\extras\google\play_licensing to the project by going into File, New, Import Module and navigating to the "library" folder. If you open the SDK Manager and click on "Launch Standalone SDK Manager" in the bottom of the popup screen, you can hover your pointer over the "Extras" folder down in the bottom and the small yellow info will tell you where you will find the package that you need to import.

Once that is done, go down to the "library" section in the left pane with "Project" and within it the "Android" tab open. Open the java section of the library and open the APKExpansionPolicy class. If you have errors and the import org.apache.http.NameValuePair and the import org.apache.http.client.utils.URLEncodedUtils are pale grey, open the build.gradle(Project:whatever) and make sure that in "buildscript" under "dependancies" you have the "classpath 'com.android.tools.build:gradle:1.5.0" included. The 1.5.0 might be different in your case. I guess it depends on your Studio version. Mine is 1.5.1. If yours is newer, you will be reminded to update the numbers.

After that, go to "build.gradle(Module:library) and include the "useLibrary 'org.apache.http.legacy' into the "android"section. Sync Now (R/H top corner) should be offered. Do it.

If you get further error messages (I wouldn't know it because I did it the other way round), the Apache files might be missing from your project, as apache is not supported any more. Find them in C/D:Users/Yourname/AppData/Local/Android/Sdk/platforms/android-23/optional and copy/paste them into yourproject/app/libs folder. You should have an optional.json and an org.apache.http.legacy.jar file in there.

Sync and rebuild/clean your project and it should be good to go.

Comment #56

Posted on Dec 18, 2015 by Grumpy Lion

Its about Google Play Services, not about play licensing.

Status: Fixed

Labels:
Type-Defect Release-M Defect-24688623