在棉花糖上打破分析?

rek*_*ire 10 android google-analytics google-play-services android-6.0-marshmallow

我正在使用分析,在编译时我得到了这个程序警告:

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
Run Code Online (Sandbox Code Playgroud)

以及更多.

我正在使用这些依赖项:

compile 'com.google.android.gms:play-services-base:7.8.0'
compile 'com.google.android.gms:play-services-gcm:7.8.0'
Run Code Online (Sandbox Code Playgroud)

这是一个错误吗?那有什么解决方法吗?

小智 12

添加到proguard

-keep public class com.google.android.gms.**
-dontwarn com.google.android.gms.**
Run Code Online (Sandbox Code Playgroud)

似乎解决了

  • 修复构建,但没有Apache HTTP,Google Play Services 7.8.0将无法与Internet通信,因此没有广告,没有Google Analytics,没有地图...... (3认同)

Bar*_*ine 7

我想如果你将遗留的Http支持添加到你的应用程序的build.gradle(只是在android部分内),那么它应该解决问题,直到GMS和其他库转移到未删除的类

android {
    useLibrary 'org.apache.http.legacy' // Need until GMS upgraded
}
Run Code Online (Sandbox Code Playgroud)

有关官方文档,请参阅此页面.


Xav*_*het 6

这是一个错误,我们需要在运行Proguard时包含所有可选的依赖项(http在API 23中是可选的),因为Proguard对于查看所有需要的类非常严格.

问题是,如果你的app项目没有声明它需要http,那么Progard将不会被配置为接收它作为库jar.

临时修复是让你的应用程序声明它需要它,但这不是你想要的.(见其他答案)

让Proguard没有警告错过课程可能不是一个好主意,但它也是可能的(参见其他答案)

无论如何,我们将在最后的1.4中解决这个问题.它应该出现在下一个beta(beta2),下周可能(2015/09/07周)