Android NDK hellojni пример не удается - PullRequest
0 голосов
/ 23 августа 2011

Я пытаюсь запустить пример из пакета NDK на плате AT91SAM9M10-EKES под управлением Android 2.1 Деятельность не удается. Это то, что я получаю в logcat. Может кто-нибудь подсказать мне это?

D/AndroidRuntime( 1153): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 1153): CheckJNI is ON
D/AndroidRuntime( 1153): --- registering native functions ---
D/ddm-heap( 1153): Got feature list request
D/AndroidRuntime( 1153): Shutting down VM
D/dalvikvm( 1153): DestroyJavaVM waiting for non-daemon threads to exit
D/dalvikvm( 1153): DestroyJavaVM shutting VM down
 D/dalvikvm( 1153): HeapWorker thread shutting down
D/dalvikvm( 1153): HeapWorker thread has shut down
D/jdwp    ( 1153): JDWP shutting down net...
I/dalvikvm( 1153): Debugger has detached; object registry had 1 entries
D/dalvikvm( 1153): VM cleaning up
E/AndroidRuntime( 1153): ERROR: thread attach failed
D/dalvikvm( 1153): LinearAlloc 0x0 used 629532 of 5242880 (12%)
D/AndroidRuntime( 1161): 
D/AndroidRuntime( 1161): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 1161): CheckJNI is ON
D/AndroidRuntime( 1161): --- registering native functions ---
D/ddm-heap( 1161): Got feature list request
I/ActivityManager(  767): Starting activity: Intent { act=android.intent.action.MAIN cat=android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.hellojni/.HelloJni }
D/AndroidRuntime( 1161): Shutting down VM
D/dalvikvm( 1161): DestroyJavaVM waiting for non-daemon threads to exit
D/dalvikvm( 1161): DestroyJavaVM shutting VM down
D/dalvikvm( 1161): HeapWorker thread shutting down
D/dalvikvm( 1161): HeapWorker thread has shut down
D/jdwp    ( 1161): JDWP shutting down net...
I/dalvikvm( 1161): Debugger has detached; object registry had 1 entries
D/dalvikvm( 1161): VM cleaning up
E/AndroidRuntime( 1161): ERROR: thread attach failed
D/dalvikvm( 1161): LinearAlloc 0x0 used 639500 of 5242880 (12%)
I/ActivityManager(  767): Start proc com.example.hellojni for activity     com.example.hellojni/.HelloJni: pid=1168 uid=10018 gids={1015}
D/ddm-heap( 1168): Got feature list request
W/dalvikvm( 1168): Exception Ljava/lang/UnsatisfiedLinkError; thrown during     Lcom/example/hellojni/HelloJni;.<clinit>
W/dalvikvm( 1168): Class init failed in newInstance call (Lcom/example/hellojni/HelloJni;)
D/AndroidRuntime( 1168): Shutting down VM
W/dalvikvm( 1168): threadid=3: thread exiting with uncaught exception (group=0x4001b168)
E/AndroidRuntime( 1168): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 1168): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 1168):    at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime( 1168):    at java.lang.Class.newInstance(Class.java:1479)
E/AndroidRuntime( 1168):    at     android.app.Instrumentation.newActivity(Instrumentation.java:1021)
E/AndroidRuntime( 1168):    at     android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
E/AndroidRuntime( 1168):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
E/AndroidRuntime( 1168):    at   android.app.ActivityThread.access$2200(ActivityThread.java:119)
E/AndroidRuntime( 1168):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
E/AndroidRuntime( 1168):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1168):    at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1168):    at android.app.ActivityThread.main(ActivityThread.java:4363)
E/AndroidRuntime( 1168):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1168):    at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 1168):    at      com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 1168):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime( 1168):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1168): Caused by: java.lang.UnsatisfiedLinkError: Library hello-jni not   found
E/AndroidRuntime( 1168):    at java.lang.Runtime.loadLibrary(Runtime.java:489)
E/AndroidRuntime( 1168):    at java.lang.System.loadLibrary(System.java:557)
E/AndroidRuntime( 1168):    at com.example.hellojni.HelloJni.<clinit>(HelloJni.java:64)
E/AndroidRuntime( 1168):    ... 15 more
I/Process (  767): Sending signal. PID: 1168 SIG: 3
I/dalvikvm( 1168): threadid=7: reacting to signal 3
E/dalvikvm( 1168): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
W/ActivityManager(  767): Launch timeout has expired, giving up wake lock!
W/ActivityManager(  767): Activity idle timeout for HistoryRecord{43d5c310   com.example.hellojni/.HelloJni}
D/dalvikvm(  813): GC freed 301 objects / 14832 bytes in 91ms
I/power   (  767): *** set_screen_state 0
E/power   (  767): Failed setting last user activity: g_error=0
W/ActivityManager(  767): Activity pause timeout for HistoryRecord{43d5c310   com.example.hellojni/.HelloJni}
D/dalvikvm(  873): GC freed 165 objects / 6624 bytes in 81ms

1 Ответ

2 голосов
/ 23 августа 2011

вы не создали библиотечный (.so) файл проекта, поэтому вы получаете эту ошибку, попробуйте собрать проект с помощью android-ndk http://developer.android.com/sdk/ndk/index.html и cygwin http://www.cygwin.com/

...