gpt4 book ai didi

android - 最新 Google 服务 (v. 21) ANE + AIRMobile 原生扩展解析界面失败

转载 作者:行者123 更新时间:2023-11-29 00:15:21 26 4
gpt4 key购买 nike

我正在尝试通过创建 native 扩展将最新的 Google Plus (google-play-services.jar) 支持添加到 Air 移动应用程序。代码没有编译时错误或警告,JAR 导出正常,ANE 构建并包含在项目中没有问题,但是当我运行我的 apk 时,它崩溃了。在 device-crush-logs 中,我可以看到以下错误:

12-04 11:08:18.602 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
12-04 11:08:18.602 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed

起初,我尝试自己从一个空项目构建一个扩展。之后我在 github github.com/alextel69/google-play-game-services-ane/找到了一个开源扩展我构建了该扩展并将其包含在我的 AIR 移动项目中并且它工作正常,但是 google-play-services.jar 太旧并且不包含我需要的类,所以我尝试用我的 Android SDK 中的最新版本替换它的 libs/google-play-services.jarlibs/android-support-v4.jar经理。这导致了上述错误。这样,我没有修改单个代码行,或 ANT 的 build.xml,或其他任何东西,我只是切换旧的 android-support-v4.jar + google-play-services .jar(工作正常!)与较新的 android-support-v4.jar + google-play-services.jar(失败)。我的意思是 ANE 构建良好,甚至创建了扩展并且它的一些方法工作并返回值,但是当我引用 google-service 代码时,我得到了那个奇怪的错误。

尽管新旧 JAR 中的接口(interface)似乎相同:dl.dropboxusercontent.com/u/13839683/ane/jars_compare.png

顺便说一下,这些错误似乎只出现在 AIR 移动版中。使用这些 android-support-v4.jar + google-play-services.jar 的纯 native 应用程序没有问题。

这是我的原生扩展的简要方案:dl.dropboxusercontent.com/u/13839683/ane/scheme.png

这是一个完整的设备日志,从扩展的诞生到它被粉碎:

12-04 11:08:18.602 23195 23195 I ~ANE~   : ------------- INITIALIZE MY EXTENSION -------------
12-04 11:08:18.602 23195 23195 I ~ANE~ : ------------- CREATE MY EXTENSION -------------
12-04 11:08:18.602 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
12-04 11:08:18.602 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed
12-04 11:08:18.602 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
12-04 11:08:18.602 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed
12-04 11:08:18.602 23195 23195 I dalvikvm: Could not find method com.google.example.games.basegameutils.GameHelper.onStop, referenced from method com.google.api.games.Context.dispose
12-04 11:08:18.602 23195 23195 W dalvikvm: VFY: unable to resolve virtual method 6754: Lcom/google/example/games/basegameutils/GameHelper;.onStop ()V
12-04 11:08:18.602 23195 23195 D dalvikvm: VFY: replacing opcode 0x6e at 0x0002
12-04 11:08:18.602 23195 23195 W dalvikvm: VFY: unable to resolve static field 2701 (Leaderboards) in Lcom/google/android/gms/games/Games;
12-04 11:08:18.602 23195 23195 D dalvikvm: VFY: replacing opcode 0x62 at 0x0000
12-04 11:08:18.612 23195 23195 W dalvikvm: VFY: unable to resolve static field 2700 (Achievements) in Lcom/google/android/gms/games/Games;
12-04 11:08:18.612 23195 23195 D dalvikvm: VFY: replacing opcode 0x62 at 0x0000
12-04 11:08:18.612 23195 23195 W dalvikvm: VFY: unable to resolve static field 2700 (Achievements) in Lcom/google/android/gms/games/Games;
12-04 11:08:18.612 23195 23195 D dalvikvm: VFY: replacing opcode 0x62 at 0x0000
12-04 11:08:18.612 23195 23195 W dalvikvm: VFY: unable to resolve static field 2700 (Achievements) in Lcom/google/android/gms/games/Games;
12-04 11:08:18.612 23195 23195 D dalvikvm: VFY: replacing opcode 0x62 at 0x0000
12-04 11:08:18.612 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
12-04 11:08:18.612 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed
12-04 11:08:18.612 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
12-04 11:08:18.612 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed
12-04 11:08:18.612 23195 23195 I dalvikvm: Could not find method com.google.example.games.basegameutils.GameHelper.beginUserInitiatedSignIn, referenced from method com.google.api.games.Context$beginUserInitiatedSignIn.call
12-04 11:08:18.612 23195 23195 W dalvikvm: VFY: unable to resolve virtual method 6715: Lcom/google/example/games/basegameutils/GameHelper;.beginUserInitiatedSignIn ()V
12-04 11:08:18.612 23195 23195 D dalvikvm: VFY: replacing opcode 0x6e at 0x0009
12-04 11:08:18.612 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
12-04 11:08:18.612 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed
12-04 11:08:18.612 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
12-04 11:08:18.612 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed
12-04 11:08:18.612 23195 23195 I dalvikvm: Could not find method com.google.example.games.basegameutils.GameHelper.signOut, referenced from method com.google.api.games.Context$signOut.call
12-04 11:08:18.612 23195 23195 W dalvikvm: VFY: unable to resolve virtual method 6767: Lcom/google/example/games/basegameutils/GameHelper;.signOut ()V
12-04 11:08:18.612 23195 23195 D dalvikvm: VFY: replacing opcode 0x6e at 0x0009
12-04 11:08:18.612 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
12-04 11:08:18.612 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed
12-04 11:08:18.612 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
12-04 11:08:18.612 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed
12-04 11:08:18.622 23195 23195 I dalvikvm: Could not find method com.google.example.games.basegameutils.GameHelper.isSignedIn, referenced from method com.google.api.games.Context$isSignedIn.call
12-04 11:08:18.622 23195 23195 W dalvikvm: VFY: unable to resolve virtual method 6740: Lcom/google/example/games/basegameutils/GameHelper;.isSignedIn ()Z
12-04 11:08:18.622 23195 23195 D dalvikvm: VFY: replacing opcode 0x6e at 0x000a
12-04 11:08:18.622 23195 23195 I ~ANE~ : Context :: testANE.call
12-04 11:08:18.622 23195 23195 I ~ANE~ : Context :: promptUserToSignInOnStartup.call
12-04 11:08:18.622 23195 23195 I ~ANE~~ : Context :: Extension.autoSignIn = true
12-04 11:08:18.622 23195 23195 I ~ANE~ : Context :: start.call
12-04 11:08:18.622 23195 23195 I ~ANE~~ : Context :: start.call[END]
12-04 11:08:18.622 480 26966 I ActivityManager: START u0 {cmp=air.com.sq.kitchen/com.google.api.games.SignInActivity} from pid 23195
12-04 11:08:18.712 23195 23195 W dalvikvm: VFY: unable to resolve virtual method 6728: Lcom/google/example/games/basegameutils/GameHelper;.getInvitationId ()Ljava/lang/String;
12-04 11:08:18.712 23195 23195 D dalvikvm: VFY: replacing opcode 0x6e at 0x0002
12-04 11:08:18.712 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
12-04 11:08:18.712 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed
12-04 11:08:18.712 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
12-04 11:08:18.712 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed
12-04 11:08:18.712 23195 23195 I dalvikvm: Could not find method com.google.example.games.basegameutils.GameHelper.getSignInError, referenced from method com.google.example.games.basegameutils.BaseGameActivity.getSignInError
12-04 11:08:18.712 23195 23195 W dalvikvm: VFY: unable to resolve virtual method 6731: Lcom/google/example/games/basegameutils/GameHelper;.getSignInError ()Lcom/google/example/games/basegameutils/GameHelper$SignInFailureReason;
12-04 11:08:18.712 23195 23195 D dalvikvm: VFY: replacing opcode 0x6e at 0x0002
12-04 11:08:18.732 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
12-04 11:08:18.732 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed
12-04 11:08:18.742 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
12-04 11:08:18.742 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed
12-04 11:08:18.762 23195 23195 D dalvikvm: VFY: replacing opcode 0x6e at 0x0002
12-04 11:08:18.762 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
12-04 11:08:18.762 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed
12-04 11:08:18.762 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
12-04 11:08:18.762 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed
12-04 11:08:18.762 23195 23195 I dalvikvm: Could not find method com.google.example.games.basegameutils.GameHelper.makeSimpleDialog, referenced from method com.google.example.games.basegameutils.BaseGameActivity.showAlert
12-04 11:08:18.762 23195 23195 W dalvikvm: VFY: unable to resolve virtual method 6746: Lcom/google/example/games/basegameutils/GameHelper;.makeSimpleDialog (Ljava/lang/String;Ljava/lang/String;)Landroid/app/Dialog;
12-04 11:08:18.762 23195 23195 D dalvikvm: VFY: replacing opcode 0x6e at 0x0002
12-04 11:08:18.762 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
12-04 11:08:18.762 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed
12-04 11:08:18.762 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
12-04 11:08:18.762 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed
12-04 11:08:18.762 23195 23195 I dalvikvm: Could not find method com.google.example.games.basegameutils.GameHelper.signOut, referenced from method com.google.example.games.basegameutils.BaseGameActivity.signOut
12-04 11:08:18.762 23195 23195 W dalvikvm: VFY: unable to resolve virtual method 6767: Lcom/google/example/games/basegameutils/GameHelper;.signOut ()V
12-04 11:08:18.762 23195 23195 D dalvikvm: VFY: replacing opcode 0x6e at 0x0002
12-04 11:08:18.762 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;'
12-04 11:08:18.762 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed
12-04 11:08:18.762 23195 23195 D dalvikvm: DexOpt: unable to opt direct call 0x1a39 at 0x08 in Lcom/google/example/games/basegameutils/BaseGameActivity;.getGameHelper
12-04 11:08:18.762 23195 23195 I ~ANE~ : SignInActivity :: onCreate
12-04 11:08:18.762 23195 23195 D AndroidRuntime: Shutting down VM
12-04 11:08:18.762 23195 23195 W dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x416dbba8)
12-04 11:08:18.762 23195 23195 E AndroidRuntime: FATAL EXCEPTION: main
12-04 11:08:18.762 23195 23195 E AndroidRuntime: Process: air.com.sq.kitchen, PID: 23195
12-04 11:08:18.762 23195 23195 E AndroidRuntime: java.lang.NoClassDefFoundError: com.google.example.games.basegameutils.GameHelper
12-04 11:08:18.762 23195 23195 E AndroidRuntime: at com.google.example.games.basegameutils.BaseGameActivity.getGameHelper(Unknown Source)
12-04 11:08:18.762 23195 23195 E AndroidRuntime: at com.google.example.games.basegameutils.BaseGameActivity.onCreate(Unknown Source)
12-04 11:08:18.762 23195 23195 E AndroidRuntime: at com.google.api.games.SignInActivity.onCreate(Unknown Source)
12-04 11:08:18.762 23195 23195 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:5231)
12-04 11:08:18.762 23195 23195 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-04 11:08:18.762 23195 23195 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
12-04 11:08:18.762 23195 23195 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
12-04 11:08:18.762 23195 23195 E AndroidRuntime: at android.app.ActivityThread.access$800(ActivityThread.java:135)
12-04 11:08:18.762 23195 23195 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
12-04 11:08:18.762 23195 23195 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
12-04 11:08:18.762 23195 23195 E AndroidRuntime: at android.os.Looper.loop(Looper.java:136)
12-04 11:08:18.762 23195 23195 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5001)
12-04 11:08:18.762 23195 23195 E AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
12-04 11:08:18.762 23195 23195 E AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:515)
12-04 11:08:18.762 23195 23195 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
12-04 11:08:18.762 23195 23195 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
12-04 11:08:18.762 23195 23195 E AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
12-04 11:08:18.782 480 14720 W ActivityManager: Force finishing activity air.com.sq.kitchen/com.google.api.games.SignInActivity
12-04 11:08:18.782 480 14720 W ActivityManager: Force finishing activity air.com.sq.kitchen/.AppEntry

inb4


我很彻底地发现了这个问题,并找到了几个类似的线程,但都没有解决我的问题

1)Google plus ane air native extension failed resolving interface的解决方案

jar xf /path-to-play-services-project/libs/google-play-services.jar

jar uf ./my_gplus_extension.jar ./com

没有解决任何问题。

2) Eclipse 的任何操作 Adobe Air 4.0 Native Extension with Google Play Services也无济于事(毕竟,我正在使用 ANT 构建 JAR)。

3) 在切换到新的 google-service-library 时,我确实修改了资源 (\google-play-services_lib\res*.*)。

4) 我什至尝试扩展 google 的界面并修改我的 GameHelper 来实现它们,但这也无济于事 (dl.dropboxusercontent.com/u/13839683/ane/extend_interface.jpg) .

最佳答案

我设法部分解决了这个问题。我问了the same question on starling-forum并且它的成员tsangwailam建议我将AIR SDK中的dx.jar替换为Android SDK中的新的。

替换 dx.jar 确实很有帮助。我把 %ANDROID_SKD%\sdk\build-tools\19.1.0\lib\dx.jar 复制到 %FLEXSDK%\lib\android\bin\dx.jar 并且扩展程序开始正常工作!

但是……

只要我运行一个 Activity SingInActivity

Intent intent = new Intent(context.getActivity().getApplicationContext(), SingInActivity.class); context.getActivity().startActivity(intent);

我的应用程序变为非 Activity 状态 - 无法处理触摸。似乎出现了一些不可见的模式弹出窗口,并且不允许我的应用程序捕捉点击。在最小化并恢复我的应用程序后,我看到 SingInActivity 进入方法“protected void onStart()”并且我知道我的应用程序“看到”了它,因为我使用 FREContext.dispatchStatusEventAsync() 将它记录到我的 Flash 的文本字段中,但应用程序仍然没有能够处理用户输入(原生 flash 和 starling/stage3d TouchEvents)这是一个有趣的事实,当我的 AIR 应用程序失去处理触摸的能力时,android 的导航按钮会从隐藏的点变成实际的按钮: https://dl.dropboxusercontent.com/u/13839683/ane/untouchable.png

至于设备日志,我没有看到任何错误或 Java 异常,或者没有任何东西(至少对我而言)可以解释这种行为。

那会是什么呢?也许我需要替换其他一些 JAR?

关于android - 最新 Google 服务 (v. 21) ANE + AIRMobile 原生扩展解析界面失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27295409/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com