Google Play 游戏 C++ SDK 示例失败,未找到库 'ButtonClickerNativeActivity'

Google Play Games C++ SDK Samples fails with Library 'ButtonClickerNativeActivity' not found

我需要试用 Google Play Games C++ SDK Samples for Android

运行 模拟器无法登录请求安装 Google Play Games... 据我所知,这需要手动完成...

运行 它来自 Samsung Samsung Galaxy Note 10.1 GT-N8010 执行 Android 4.1.2,Button Clicker 应用程序在启动时失败并出现以下错误:

Cannot load library: load_library[1094]: Library 'ButtonClickerNativeActivity' not found

注意:当我从模拟器 运行 时,这个错误不会出现。

我不明白为什么会失败以及如何修复或解决此失败。

样本以这种方式加载:

public class ButtonClickerNativeActivity extends NativeActivity {
    // Load SO
    static {
        System.load("libButtonClickerNativeActivity.so");
    }

我确认软件包 (ButtonClicker-debug.apk) 在 lib 文件夹中包含 armeabi、armeabi-v7a 和 x86 的库。

这是应用程序启动的 logcat 列表:

01-28 15:18:44.885 31258-31258/? D/dalvikvm: Late-enabling CheckJNI
01-28 15:18:44.900 31258-31264/? E/jdwp: Failed sending reply to debugger: Broken pipe
01-28 15:18:44.900 31258-31264/? D/dalvikvm: Debugger has detached; object registry had 1 entries
01-28 15:18:44.945 31258-31258/? W/ActivityThread: Application com.google.example.games.ButtonClicker is waiting for the debugger on port 8100...
01-28 15:18:44.960 31258-31258/? I/System.out: Sending WAIT chunk
01-28 15:18:45.915 31258-31264/com.google.example.games.ButtonClicker I/dalvikvm: Debugger is active
01-28 15:18:45.965 31258-31258/com.google.example.games.ButtonClicker I/System.out: Debugger has connected
01-28 15:18:45.965 31258-31258/com.google.example.games.ButtonClicker I/System.out: waiting for debugger to settle...
01-28 15:18:46.165 31258-31258/com.google.example.games.ButtonClicker I/System.out: waiting for debugger to settle...
01-28 15:18:46.365 31258-31258/com.google.example.games.ButtonClicker I/System.out: waiting for debugger to settle...
01-28 15:18:46.565 31258-31258/com.google.example.games.ButtonClicker I/System.out: waiting for debugger to settle...
01-28 15:18:46.765 31258-31258/com.google.example.games.ButtonClicker I/System.out: waiting for debugger to settle...
01-28 15:18:46.965 31258-31258/com.google.example.games.ButtonClicker I/System.out: waiting for debugger to settle...
01-28 15:18:47.170 31258-31258/com.google.example.games.ButtonClicker I/System.out: waiting for debugger to settle...
01-28 15:18:47.370 31258-31258/com.google.example.games.ButtonClicker I/System.out: debugger has settled (1325)
01-28 15:18:47.510 31258-31258/com.google.example.games.ButtonClicker D/dalvikvm: Trying to load lib ButtonClickerNativeActivity 0x423b2428
01-28 15:18:47.515 31258-31258/com.google.example.games.ButtonClicker W/dalvikvm: Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/google/example/games/ButtonClicker/ButtonClickerNativeActivity;
01-28 15:18:47.515 31258-31258/com.google.example.games.ButtonClicker W/dalvikvm: Class init failed in newInstance call (Lcom/google/example/games/ButtonClicker/ButtonClickerNativeActivity;)
01-28 15:18:47.515 31258-31258/com.google.example.games.ButtonClicker D/AndroidRuntime: Shutting down VM
01-28 15:18:47.515 31258-31258/com.google.example.games.ButtonClicker W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41c3d2a0)
01-28 15:18:47.525 31258-31258/com.google.example.games.ButtonClicker E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                        java.lang.ExceptionInInitializerError
                                                                                            at java.lang.Class.newInstanceImpl(Native Method)
                                                                                            at java.lang.Class.newInstance(Class.java:1319)
                                                                                            at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
                                                                                            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2025)
                                                                                            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
                                                                                            at android.app.ActivityThread.access0(ActivityThread.java:140)
                                                                                            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
                                                                                            at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                            at android.os.Looper.loop(Looper.java:137)
                                                                                            at android.app.ActivityThread.main(ActivityThread.java:4921)
                                                                                            at java.lang.reflect.Method.invokeNative(Native Method)
                                                                                            at java.lang.reflect.Method.invoke(Method.java:511)
                                                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
                                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
                                                                                            at dalvik.system.NativeStart.main(Native Method)
                                                                                         Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: load_library[1094]: Library 'ButtonClickerNativeActivity' not found
                                                                                            at java.lang.Runtime.load(Runtime.java:340)
                                                                                            at java.lang.System.load(System.java:521)
                                                                                            at com.google.example.games.ButtonClicker.ButtonClickerNativeActivity.(ButtonClickerNativeActivity.java:29)
                                                                                            at java.lang.Class.newInstanceImpl(Native Method) 
                                                                                            at java.lang.Class.newInstance(Class.java:1319) 
                                                                                            at android.app.Instrumentation.newActivity(Instrumentation.java:1068) 
                                                                                            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2025) 
                                                                                            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135) 
                                                                                            at android.app.ActivityThread.access0(ActivityThread.java:140) 
                                                                                            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237) 
                                                                                            at android.os.Handler.dispatchMessage(Handler.java:99) 
                                                                                            at android.os.Looper.loop(Looper.java:137) 
                                                                                            at android.app.ActivityThread.main(ActivityThread.java:4921) 
                                                                                            at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                                            at java.lang.reflect.Method.invoke(Method.java:511) 
                                                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038) 
                                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805) 
                                                                                            at dalvik.system.NativeStart.main(Native Method) 
01-28 15:18:58.720 31258-31258/? I/Process: Sending signal. PID: 31258 SIG: 9

我更改了示例代码中的以下行 (ButtonClickerNativeActivity.java),应用程序在三星设备上启动时没有出现异常。

public class ButtonClickerNativeActivity extends NativeActivity {
    // Load SO
    static {
        //System.load("libButtonClickerNativeActivity.so");
        System.loadLibrary("ButtonClickerNativeActivity");
    }