GOOGLE 播放服务异常:com.google.android.gms.common.GooglePlayServicesUtil

GOOGLE PLAY SERVICES EXCEPTION: com.google.android.gms.common.GooglePlayServicesUtil

我正在尝试将 Google Play 游戏集成到我的应用程序中。它目前在调试模式下工作。但是,它似乎不适用于发布模式。我收到错误。我尝试清理并重建。

java.lang.RuntimeException: Unable to get provider com.google.android.gms.measurement.AppMeasurementContentProvider: java.lang.ClassNotFoundException

然后是这个:

GOOGLE PLAY SERVICES EXCEPTION: com.google.android.gms.common.GooglePlayServicesUtil

紧随其后的是:

There is a problem with the Google Play Services library, which is required for Android Advertising ID support. The Google Play Services library should be integrated in any app shipping in the Play Store that uses analytics or advertising.

有什么问题吗?我尝试使用 Gradle 进行试验,但还没有成功。

如果我禁用 Proguard,它就可以工作!这似乎是一个已知问题,但尚未解决。有什么想法吗?

问题是在我的Gradle中我使用的是

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

现在我正在使用

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

在您的 proguard-rule.pro 中添加以下代码并尝试重新生成 APK

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