unity-game-engine - unity 设置 Google Play 服务时出错

标签 unity-game-engine google-play-services

按照 google play games plugin for unity 上的说明进行操作,我无法正确设置它。我的应用程序在登录时崩溃,并显示以下日志输出(没有更多详细信息)。我没有找到可能的原因,并且搜索似乎没有任何有用的提示。

实际错误显示为:

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

完整的日志输出:

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)

我已经采取了生成 OAuth2 客户端 ID 所需的步骤,并且已成功将其应用到统一的 GooglePlayGame 插件中。错误消息的原因可能是什么?

最佳答案

如果我们引用日志输出中显示的实际错误,则问题是由 list 中声明的​​ application ID 引起的,这实际上是开发人员犯下的最严重的设置错误之一,如本 video 所示。

要解决此类错误,请检查以下内容:

对于 Android:

  • 请验证 @string/app_id 资源的值是否与您的应用程序的数字 ID 匹配。该资源的值只能包含数字。例如:

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

    警告:请勿使用完整的客户端 ID ( 1233456789012.apps.googleusercontent.com ) 作为您的应用 ID。这将导致错误。

对于 iOS:

  • application_ID 是 Google Play 开发者控制台分配给您的项目的编号。请注意,这与您的 Apple application_ID 不同。

然后,在检查 application ID 后,请同时检查 certificate fingerprint 。请注意:

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.

有关其他提示,请参阅以下相关资源:

最后,这个 Q&A thread 也可能对建议这个 GitHub post 有所帮助。

关于unity-game-engine - unity 设置 Google Play 服务时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39934727/

相关文章:

animation - blender 中的汽车装备并导入到 Unity

Android P 上的 AndroidAdvertisingId 异常

android-studio - 如何在 Android Studio 中查找 google play 服务版本?

unity-game-engine - 检测透明度的网格碰撞器

c# - 团结 : Create a texture from Terrain

javascript - C# 意外符号 }

android - Firebase 与 appcompat 不兼容

google-play-services - 如何像 PendingResult.await 一样同步运行新的 gms Task 对象?

android - Google Play 服务 DriveApi 更改文件父级

unity-game-engine - 在 Unity 中访问 TM Pro InputField 文本