Error in setting up Google play services in unity

2019-05-10 12:55发布

Following the instruction on google play games plugin for unity, I have not been able to set it up correctly. My application crashes on signing in, with the following log output (with no more details). I've got no luck in finding a probable cause and searches seems to be out of any useful tip.

The actual error is displayed as:

Application ID () must be a numeric value. Please verify that your manifest refers to the correct project ID

The complete log output:

10-08 19:43:49.581 25688-25734/? E/linker: readlink('/proc/self/fd/49') failed: Permission denied [fd=49]
10-08 19:43:49.581 25688-25734/? E/linker: warning: unable to get realpath for the library "/data/data/com.testcompany.testapp/app_.gpg.classloader/d75c8e1bbeab9e1ddffb9d332585db71.dex". Will use given name.
10-08 19:43:49.667 25688-25734/? W/PopupManager: You have not specified a View to use as content view for popups. Falling back to the Activity content view. Note that this may not work as expected in multi-screen environments
10-08 19:43:49.675 25688-26526/? I/GamesNativeSDK: Auth operation started: SIGN IN
10-08 19:43:49.675 25688-26526/? I/GamesNativeSDK: Connecting to Google Play...
10-08 19:43:49.802 10946-10956/? W/GamesServiceBroker: Client connected with SDK 9683000, Services 9683438, and Games 37240038
10-08 19:43:49.837 10946-26540/? E/ValidateServiceOp: Application ID () must be a numeric value. Please verify that your manifest refers to the correct project ID.
10-08 19:43:49.842 25688-25688/? D/AndroidRuntime: Shutting down VM
10-08 19:43:49.846 25688-25688/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                   Process: com.testcompany.testapp, PID: 25688
                                                   java.lang.Error: FATAL EXCEPTION [main]
                                                   Unity version     : 5.4.0f3
                                                   Device model      : LGE Nexus 5
                                                   Device fingerprint: google/hammerhead/hammerhead:6.0/MRA58K/2256973:user/release-keys

                                                   Caused by: java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
                                                       at com.google.android.gms.common.internal.zze$zza.zzc(Unknown Source)
                                                       at com.google.android.gms.common.internal.zze$zza.zzv(Unknown Source)
                                                       at com.google.android.gms.common.internal.zze$zze.zzauc(Unknown Source)
                                                       at com.google.android.gms.common.internal.zze$zzd.handleMessage(Unknown Source)
                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                       at android.os.Looper.loop(Looper.java:148)
                                                       at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

I've taken the steps needed to generate OAuth2 client ID and I've successfully applied that to GooglePlayGame plugin in unity. What could be the reason of the error message?

3条回答
看我几分像从前
2楼-- · 2019-05-10 13:31

The problem was caused by multiple application configurations in Google play services. Although the game services panel was showing only one application with my package name, there were several instances of the same application configured in google cloud services previously for google cloud messaging and other services. The problem was only solved when I shut down all services, deleted the applications and patiently created one unified application configuration in Google play services.

查看更多
再贱就再见
3楼-- · 2019-05-10 13:33

I got this problem too. Here's My solution:

Delete old version of GooglePlayService and Admob plugins and import the new ones.

Open Android SDK Manager(In Unity, Window -> Google Play Games -> Downloads -> Google Play Gamse SDK(Android)), update the following ones: enter image description here

Then try to set up Goole Play Service.

Additional, current verion of GooglPlayServices and Admob both import PlayServicesResolver/Editor/Google.JarResolverLib.dll(JarResolverLib.dll), just delete Google.JarResolerLib.dll.

Hope this can help you!

查看更多
时光不老,我们不散
4楼-- · 2019-05-10 13:42

If we refer to the actual error as shown in your log output, the problem is caused by the application ID declared in your Manifest which is actually one of the top setup mistakes committed by developers as shown in this video.

To troubleshoot this kind of error, please check the following:

For Android:

  • please verify that the value of the @string/app_id resource matches your application's numeric ID. The value of this resource should only contain digits. For example:

    <string name="app_id">123456789012</string>

    Warning: Do not use the full client ID (1233456789012.apps.googleusercontent.com) as your app ID. This will result in errors.

For iOS:

  • The application_ID is the number that Google Play Developer Console assigns to your project. Please note that is not the same as your Apple application_ID.

Then, after checking the application ID, please also check the certificate fingerprint. Please be noted that:

If you are debugging your game using your debug certificate but have configured games services using your release certificate, you should add a second linked app using the same package name and your debug certificate's SHA1 fingerprint. This will allow you to sign in to the application whether it's signed with the debug or release certificates.

For additional tips, refer to these related resources:

Lastly, this Q&A thread might also help wherein this GitHub post was suggested.

查看更多
登录 后发表回答