gpt4 book ai didi

android - 在启用 Proguard 的情况下将 Play 服务从 8.1 更新到 8.3

转载 作者:IT老高 更新时间:2023-10-28 22:26:20 24 4
gpt4 key购买 nike

我尝试将播放服务更新到 8.3。这是我改变的:

在根 gradle 文件中:

dependencies {
classpath 'com.android.tools.build:gradle:1.5.0-beta1'
classpath 'com.google.gms:google-services:1.5.0-beta2'
}

在应用程序的 gradle 文件中:

compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
compile 'com.google.android.gms:play-services-base:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.google.android.gms:play-services-analytics:8.3.0'
compile 'com.google.android.gms:play-services-appinvite:8.3.0'
compile 'com.google.android.gms:play-services-ads:8.3.0'
compile 'com.google.android.gms:play-services-appindexing:8.3.0'

运行良好,但在启动时崩溃并显示以下堆栈跟踪:

11-06 17:30:17.460 2895-2895/app.example.debug E/AndroidRuntime: 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 "/system/framework/android.test.runner.jar", zip file "/data/app/app.example.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/app.example.debug-1/lib/arm, /vendor/lib, /system/lib]]
11-06 17:30:17.460 2895-2895/app.example.debug E/AndroidRuntime: at android.app.ActivityThread.installProvider(ActivityThread.java:5156)
11-06 17:30:17.460 2895-2895/app.example.debug E/AndroidRuntime: at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
11-06 17:30:17.460 2895-2895/app.example.debug E/AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
11-06 17:30:17.460 2895-2895/app.example.debug E/AndroidRuntime: at android.app.ActivityThread.-wrap1(ActivityThread.java)
11-06 17:30:17.460 2895-2895/app.example.debug E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
11-06 17:30:17.460 2895-2895/app.example.debug E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
11-06 17:30:17.460 2895-2895/app.example.debug E/AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
11-06 17:30:17.460 2895-2895/app.example.debug E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417)
11-06 17:30:17.460 2895-2895/app.example.debug E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
11-06 17:30:17.460 2895-2895/app.example.debug E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-06 17:30:17.460 2895-2895/app.example.debug E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

我们启用了 proguard,并且在我们构建的 apk 中通常有大约 50/55k 方法。但是通过这种设置,我们得到了 26k。

我们原来的配置是

classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.google.gms:google-services:1.4.0-beta3'

8.1.0 版本的所有播放服务依赖项

知道那里发生了什么吗?

编辑

这是我们的 proguard 文件:

# will keep line numbers and file name obfuscation
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable

-optimizations !code/allocation/variable

-dontwarn javax.mail.**
-dontwarn javax.management.**
-dontwarn javax.rmi.**
-dontwarn javax.naming.**
-dontwarn javax.transaction.**
-dontwarn javax.persistence.**
-dontwarn java.lang.management.**
-dontwarn java.lang.instrument.**
-dontwarn org.slf4j.**
-dontwarn org.json.**

-keep class org.apache.**
-dontwarn org.apache.**
-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**

-dontwarn org.springframework.**

-dontwarn sun.misc.Unsafe
-dontwarn com.google.gwt.**


# Allow obfuscation of android.support.v7.internal.view.menu.**
# to avoid problem on Samsung 4.2.2 devices with appcompat v21
# see https://code.google.com/p/android/issues/detail?id=78377
-keep class !android.support.v7.internal.view.menu.*MenuBuilder*, android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }

# Configuration for Fabric Twitter Kit
# See: https://dev.twitter.com/twitter-kit/android/integrate

-dontwarn com.squareup.okhttp.**
-dontwarn com.google.appengine.api.urlfetch.**
-dontwarn rx.**
-dontwarn retrofit.**
-keepattributes Signature
-keepattributes *Annotation*
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-keep class retrofit.** { *; }
-keepclasseswithmembers class * {
@retrofit.http.* *;
}


# For using GSON @Expose annotation
-keepattributes *Annotation*
-keepattributes EnclosingMethod


# Gson specific classes
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.** { *; }


# Branch
-keep class com.google.android.gms.ads.identifier.** { *; }


# OkHttp
-dontwarn rx.**

-dontwarn okio.**

-dontwarn com.squareup.okhttp.**
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }

-dontwarn retrofit.**
-dontwarn retrofit.appengine.UrlFetchClient
-keep class retrofit.** { *; }
-keepclasseswithmembers class * {
@retrofit.http.* <methods>;
}


# LeakCanary
-keep class org.eclipse.mat.** { *; }
-keep class com.squareup.leakcanary.** { *; }
-dontwarn com.squareup.leakcanary.DisplayLeakService


#Intercom
-dontwarn intercom.**
-dontwarn io.intercom.**


#Eventbus
-keepclassmembers class ** {
public void onEvent*(**);
}


-keep class com.google.appengine.api.datastore.Text { *; }

最佳答案

更新你的

classpath 'com.google.gms:google-services:1.5.0-beta2'

到刚刚发布的

classpath 'com.google.gms:google-services:1.5.0'

关于android - 在启用 Proguard 的情况下将 Play 服务从 8.1 更新到 8.3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33571555/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com