适用于Unity示例应用的Firebase崩溃:找不到类'com.google.android.gms.common.api.PendingResult'

时间:2016-12-14 21:25:22

标签: android unity3d firebase firebase-authentication

我正在尝试为Unity运行Firebase示例身份验证应用程序(来自here), 但是应用程序在初始化期间崩溃了。

这是崩溃日志:

D/dalvikvm(18363): Trying to load lib /mnt/asec/com.google.firebase.unity.auth.testapp-2/lib/libApp.so 0x42351d70
D/dalvikvm(18363): Added shared lib /mnt/asec/com.google.firebase.unity.auth.testapp-2/lib/libApp.so 0x42351d70
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/firebase/app/internal/cpp/Log'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/firebase/app/internal/cpp/Log'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/firebase/app/internal/cpp/JniResultCallback'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/firebase/app/internal/cpp/JniResultCallback'
E/dalvikvm(18363): Could not find class 'com.google.android.gms.common.api.PendingResult', referenced from method com.google.firebase.app.internal.cpp.JniResultCallback.initializeWithPendingResultOrTask
W/dalvikvm(18363): VFY: unable to resolve instanceof 4 (Lcom/google/android/gms/common/api/PendingResult;) in Lcom/google/firebase/app/internal/cpp/JniResultCallback;
D/dalvikvm(18363): VFY: replacing opcode 0x20 at 0x0000
I/dalvikvm(18363): Failed resolving Lcom/google/firebase/app/internal/cpp/JniResultCallback$PendingResultCallback; interface 6 'Lcom/google/android/gms/common/api/ResultCallback;'
W/dalvikvm(18363): Link of class 'Lcom/google/firebase/app/internal/cpp/JniResultCallback$PendingResultCallback;' failed
D/dalvikvm(18363): DexOpt: unable to opt direct call 0x0013 at 0x08 in Lcom/google/firebase/app/internal/cpp/JniResultCallback;.initializeWithPendingResultOrTask
I/dalvikvm(18363): Failed resolving Lcom/google/firebase/app/internal/cpp/JniResultCallback$TaskCallback; interface 9 'Lcom/google/android/gms/tasks/OnSuccessListener;'
W/dalvikvm(18363): Link of class 'Lcom/google/firebase/app/internal/cpp/JniResultCallback$TaskCallback;' failed
D/dalvikvm(18363): DexOpt: unable to opt direct call 0x0016 at 0x12 in Lcom/google/firebase/app/internal/cpp/JniResultCallback;.initializeWithPendingResultOrTask
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/firebase/app/internal/cpp/CppThreadDispatcher'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/firebase/app/internal/cpp/CppThreadDispatcher'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/firebase/analytics/FirebaseAnalytics'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/firebase/analytics/FirebaseAnalytics'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/android/gms/ads/MobileAds'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/android/gms/ads/MobileAds'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/firebase/crash/FirebaseCrash'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/firebase/crash/FirebaseCrash'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/android/gms/appinvite/AppInvite'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/android/gms/appinvite/AppInvite'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/firebase/messaging/FirebaseMessaging'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/firebase/messaging/FirebaseMessaging'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/firebase/remoteconfig/FirebaseRemoteConfigInfo'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/firebase/remoteconfig/FirebaseRemoteConfigInfo'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/firebase/app/internal/cpp/Log'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/firebase/app/internal/cpp/Log'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/firebase/app/internal/cpp/JniResultCallback'
W/dalvikvm(18363): dvmFindClassByName rejecting 'com/google/firebase/app/internal/cpp/JniResultCallback'
E/dalvikvm(18363): Could not find class 'com.google.android.gms.common.api.PendingResult', referenced from method com.google.firebase.app.internal.cpp.JniResultCallback.initializeWithPendingResultOrTask
W/dalvikvm(18363): VFY: unable to resolve instanceof 4 (Lcom/google/android/gms/common/api/PendingResult;) in Lcom/google/firebase/app/internal/cpp/JniResultCallback;

1 个答案:

答案 0 :(得分:1)

您似乎错过了包含PendingResult的Play服务基础AAR,这可能意味着您也错过了SDK的其他Android依赖项。

当您选择Android作为目标平台时,您应该在项目的Assets文件夹中看到如下所示的AAR: *资产/插件/ Android / play-services-base-10.0.1.aar

这包含PendingResult类......

$ unzip Plugins/Android/play-services-base-10.0.1.aar classes.jar
  Archive:  Plugins/Android/play-services-base-10.0.1.aar
  inflating: classes.jar      
$ unzip -l classes.jar  | grep /PendingResult\.class
  1762  11-22-16 22:25 com/google/android/gms/common/api/PendingResult.class

您的项目可能会出现一些错误:

  • 您已禁用Android解析器(通过资产启用它 - >播放服务解析程序 - > Android解析程序 - >设置菜单项)
  • 您项目中的Android AAR组合不匹配。 删除 Assets / Plugins / Android / 下的所有.aars,并允许Android Resolver提取最新的设置。