playgameservices / android-basic-samples

Google Play game services - Android samples
Apache License 2.0
970 stars 972 forks source link

Internal error when opening Saved Games UI #286

Closed obigu closed 5 years ago

obigu commented 5 years ago

We have recently started receiving reports from users on of a crash when opening the default GPGS Saved Games UI. The app has been live for a long time now without issues and the logic it uses has not changed and it's been taken directly from the official docs (https://developers.google.com/games/services/android/savedgames#displaying_saved_games).

We've reproduced it and this is the crash report:

11-11 00:40:08.126 9307-9307/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.google.android.play.games.ui, PID: 9307
    java.lang.NullPointerException: null reference
        at goo.a(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):1)
        at kkb.a(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):9)
        at kkl.a(Unknown Source:4)
        at kkv.b(Unknown Source:21)
        at kkv.a(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):1)
        at kkb.a(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):12)
        at kkk.a(Unknown Source:4)
        at bsc.b(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):38)
        at bsc.e(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):5)
        at bsc.f_(Unknown Source:5)
        at bth.handleMessage(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):20)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6680)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

The issue seems to be related to the latest Google Play Services version and not to a specific change on our app as we can also reproduce it on previous production APKs that worked without any issue.

UPDATE 2: The issue reproduces on Google Play Games version 5.13.7466 tested on an Android 9, Android 8.1 and an Android 6.0.1 device. It works correctly on Google Play Games 5.10 which confirms it's a bug on the latest version of Google Play Games.

obigu commented 5 years ago

Update: There's the following warning before the crash (the project depends on appcompat v7 and can confirm the class is inside the APK). We have reproduced without using ProGuard.

11-11 03:16:52.188 14979-14979/? I/AppCompatDelegate: Failed to instantiate custom view inflater android.support.v7.app.AppCompatViewInflater. Falling back to default.
    java.lang.ClassNotFoundException: android.support.v7.app.AppCompatViewInflater
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:453)
        at java.lang.Class.forName(Class.java:378)
        at acl.a(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):14)
        at acl.onCreateView(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):1)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
        at com.android.internal.policy.DecorView.onResourcesLoaded(DecorView.java:1885)
        at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:2599)
        at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2672)
        at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2071)
        at acl.p(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):8)
        at acl.a(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):51)
        at aci.findViewById(Unknown Source:4)
        at hzj.<init>(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):15)
        at hno.a(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):6)
        at gdy.b(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):10)
        at kaz.<init>(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):8)
        at kbd.onCreate(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):7)
        at com.google.android.gms.games.ui.clientv2.snapshots.SnapshotListActivity.onCreate(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):1)
        at android.app.Activity.performCreate(Activity.java:7144)
        at android.app.Activity.performCreate(Activity.java:7135)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2894)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3049)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1809)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6680)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.app.AppCompatViewInflater" on path: DexPathList[[zip file "/data/app/com.google.android.play.games-1DgKPqbQZ8JXqx89lQLT8A==/base.apk"],nativeLibraryDirectories=[/data/app/com.google.android.play.games-1DgKPqbQZ8JXqx89lQLT8A==/lib/arm64, /data/app/com.google.android.play.games-1DgKPqbQZ8JXqx89lQLT8A==/base.apk!/lib/arm64-v8a, /system/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at java.lang.Class.classForName(Native Method) 
        at java.lang.Class.forName(Class.java:453) 
        at java.lang.Class.forName(Class.java:378) 
        at acl.a(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):14) 
        at acl.onCreateView(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):1) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
        at com.android.internal.policy.DecorView.onResourcesLoaded(DecorView.java:1885) 
        at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:2599) 
        at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2672) 
        at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2071) 
        at acl.p(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):8) 
        at acl.a(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):51) 
        at aci.findViewById(Unknown Source:4) 
        at hzj.<init>(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):15) 
        at hno.a(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):6) 
        at gdy.b(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):10) 
        at kaz.<init>(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):8) 
        at kbd.onCreate(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):7) 
        at com.google.android.gms.games.ui.clientv2.snapshots.SnapshotListActivity.onCreate(:com.google.android.play.games@74660040@5.13.7466 (218554949.218554949-000400):1) 
        at android.app.Activity.performCreate(Activity.java:7144) 
        at android.app.Activity.performCreate(Activity.java:7135) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2894) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3049) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1809) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6680) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
tm0ngy commented 5 years ago

I'm having the exact same problem in my game. Did you manage to find any soultion to this?

obigu commented 5 years ago

@tm0ngy No, it's a bug on GPG latest version, hopefully Google team will see this and work on a fix for the next version. What I've noticed is that an old project based on the old BaseGameUtils class doesn't fail and that's probably why it doesn't affect all games but just the ones implemented in the new recommended manner.

tm0ngy commented 5 years ago

@obigu Yeah I hope they fix it soon. I've noticed that sometimes if I start the "Play Games" app on the phone before I launch my app, the saved games UI shows up normally. But then, if the saved game is modified by playing the game, the saved game UI crashes with the same error you posted above again.

obigu commented 5 years ago

In my case my app doesn't save automatically but I also see a similar behaviour. When the app has just been installed, the first time the Saved Games UI is opened it works fine. From then on, unless you do a Clear Data on the Google Play Games app, it fails on subsequent attempts to open it.

tm0ngy commented 5 years ago

Seems the issue is finally fixed in the new version of Google Play Games (5.14.7825)

obigu commented 5 years ago

Seems the issue is finally fixed in the new version of Google Play Games (5.14.7825)

Yup, closing issue