我需要尝试Google Play Games C++ SDK Samples for Android。
从模拟器运行它无法登录请求安装Google Play Games ...这需要手动完成,据我所知......
从执行Android 4.1.2的Samsung Samsung Galaxy Note 10.1 GT-N8010运行它,Button Clicker应用程序在启动时失败,出现以下错误:
无法加载库:load_library [1094]:库 找不到'ButtonClickerNativeActivity'
注意:从模拟器运行时,此错误不会显示。
我不明白为什么会失败以及如何修复或解决这个失败。
示例以这种方式加载:
public class ButtonClickerNativeActivity extends NativeActivity {
// Load SO
static {
System.load("libButtonClickerNativeActivity.so");
}
我确认包(ButtonClicker-debug.apk)包含armeabi,armeabi-v7a和x86的lib文件夹中的库。
以下是应用启动的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.access$700(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.access$700(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
答案 0 :(得分:0)
我更改了示例代码(ButtonClickerNativeActivity.java)中的以下行以及在Samsung设备上启动的应用程序,没有例外。
public class ButtonClickerNativeActivity extends NativeActivity {
// Load SO
static {
//System.load("libButtonClickerNativeActivity.so");
System.loadLibrary("ButtonClickerNativeActivity");
}