Home » Android » android – Analytics broken on Marshmallow?

android – Analytics broken on Marshmallow?

Posted by: admin May 14, 2020 Leave a comment

Questions:

I’m using analytics and while compiling I get this proguard warnings:

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

and much more.

I’m using these dependencies:

compile 'com.google.android.gms:play-services-base:7.8.0'
compile 'com.google.android.gms:play-services-gcm:7.8.0'

Is this a bug? Is there any workaround for that?

How to&Answers:

Adding to proguard

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

seems to fix

Answer:

I think if you add the legacy Http support to the build.gradle of your app (just inside the android section) then it should resolve the issue until GMS and other libraries move to the non-removed classes

android {
    useLibrary 'org.apache.http.legacy' // Need until GMS upgraded
}

See this page for official documentation.

Answer:

It’s a bug, we need to include all optional dependencies (http is now optional in API 23) when running Proguard, as Proguard is very strict about seeing all the needed classes.

The problem is that if your app project doesn’t declare that it needs http, then Progard won’t be configured to receive it as a library jar.

A temporary fix would be to make your app declare that it needs it, but that’s not really what you want either. (see the other answers)

Making Proguard not warn about missing classes is probably not a good idea, but it’s possible too (see the other answers)

Anyway, we’ll fix this in the final 1.4. It should show up in the next beta (beta2), next week probably (week of 2015/09/07)

Answer:

It is probably a bug, note that Android Marshmallow is not released yet, and according to comments on Google+ when “Android Developers” made a post about the SDK, there are many bugs with proguard and other stuff. Wait until a newer version of the SDK comes out.

Answer:

According to the API 22-23 diff changes, the org.apache.http.* packages have been removed as of Android 6.0 (Marshmallow) API Level 23.

http://developer.android.com/sdk/api_diff/23/changes.html

via : http://android-developers.blogspot.co.uk/2015/08/m-developer-preview-3-final-sdk.html