java – 在Android应用程序中添加新的Google登录后,Proguard混淆问题

前端之家收集整理的这篇文章主要介绍了java – 在Android应用程序中添加新的Google登录后,Proguard混淆问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在新的Google Play服务库(8.3.0)中,有一种新的登录方式.此方法涉及添加以下依赖项:

build.gradle(app level):
classpath’com.google.gms:google-services:1.4.0-beta3′

在应用程序级别:

compile 'com.google.android.gms:play-services-auth:8.3.0'

`apply plugin: 'com.google.gms.google-services'`

在创建minifyEnabled设置为false的发布应用版本时,该应用程序正在发布并正常工作.但是,在创建发布版本时
minifyEnabled设置为true,应用程序在启动时崩溃,但出现以下异常:

java.lang.RuntimeException: Unable to get provider com.google.android.gms.measurement.AppMeasurementContentProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.measurement.AppMeasurementContentProvider" on path: DexPathList[[zip file "/data/app/com.xxx.xxx-1/base.apk"],nativeLibraryDirectories=[/data/app/com.xxx.xxx-1/lib/arm,/vendor/lib,/system/lib]]
11-08 12:47:13.497 3672-3672/? E/AndroidRuntime:     at android.app.ActivityThread.installProvider(ActivityThread.java:5156)
11-08 12:47:13.497 3672-3672/? E/AndroidRuntime:     at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
11-08 12:47:13.497 3672-3672/? E/AndroidRuntime:     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
11-08 12:47:13.497 3672-3672/? E/AndroidRuntime:     at android.app.ActivityThread.-wrap1(ActivityThread.java)
11-08 12:47:13.497 3672-3672/? E/AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
11-08 12:47:13.497 3672-3672/? E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:102)
11-08 12:47:13.497 3672-3672/? E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:148)
11-08 12:47:13.497 3672-3672/? E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5417)
11-08 12:47:13.497 3672-3672/? E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
11-08 12:47:13.497 3672-3672/? E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-08 12:47:13.497 3672-3672/? E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
11-08 12:47:13.497 3672-3672/? E/AndroidRuntime:  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.measurement.AppMeasurementContentProvider" on path: DexPathList[[zip file "/data/app/xxx.xxx...

我试图将这些设置添加到proguard项目配置中,但它没有帮助(同样的异常一直出现):

-optimizationpasses 5
-keepattributes SourceFile,LineNumberTable,Exceptions,Signature,InnerClasses,*Annotation*
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**

解决方法

我已经提交了 bug report for this.
原文链接:https://www.f2er.com/android/129204.html

猜你在找的Android相关文章