7

In the new Google Play Services library (8.3.0) there is a new way to perform sign-in. This method involves adding the following dependencies:

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

And on app level:

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

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

When creating a release app version with minifyEnabled set to false, the app is being released and works fine. However, when creating a release version with minifyEnabled set to true the app crashes on startup with the following exception:

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...

I have tried to add these settings to the proguard project config but it doesn't help (same exception keeps appearing):

-optimizationpasses 5
-keepattributes SourceFile,LineNumberTable,Exceptions, Signature, InnerClasses,*Annotation*
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**
Peter
  • 10,910
  • 3
  • 35
  • 68
  • You probably need to add `-keepattributes Exceptions, Signature, InnerClasses` as well. – ztan Nov 09 '15 at 20:26
  • Unfortunately this doesn't help, I have edited the question to show the (relevant) proguard parts. – Peter Nov 09 '15 at 21:23
  • potentially a bug, you can file in the Android public issue tracker https://code.google.com/p/android/issues/list – ztan Nov 09 '15 at 22:01

1 Answers1

0

I've already filed a bug report for this.

Jeff Sutton
  • 901
  • 7
  • 6
  • 3
    Thanks, I guess that the fix for this bug report has been implemented in release 1.5.0 of the google-services plugin. Adding this dependency fixed the issue for me: classpath 'com.google.gms:google-services:1.5.0' – Peter Nov 12 '15 at 22:15