issues running the hello-jni example on MotoDev studio
i was trying to run the hello-jni example that comes bundled with the NDK samples. i keep getting the following error on the emulator and the phone everytime i try executing my app:
"The application JNIExample (process com.jniexample) has stopped unexpectedly. Pl开发者_开发技巧ease try again"
Here's the content of log cat:
12-07 15:52:23.199: ERROR/AndroidRuntime(353): FATAL EXCEPTION: main 12-07 15:52:23.199: ERROR/AndroidRuntime(353): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.jniexample/com.jniexample.JNIExample}: java.lang.ClassNotFoundException: com.jniexample.JNIExample in loader dalvik.system.PathClassLoader[/data/app/com.jniexample-2.apk] 12-07 15:52:23.199: ERROR/AndroidRuntime(353): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585) 12-07 15:52:23.199: ERROR/AndroidRuntime(353): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 12-07 15:52:23.199: ERROR/AndroidRuntime(353): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 12-07 15:52:23.199: ERROR/AndroidRuntime(353): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 12-07 15:52:23.199: ERROR/AndroidRuntime(353): at android.os.Handler.dispatchMessage(Handler.java:99) 12-07 15:52:23.199: ERROR/AndroidRuntime(353): at android.os.Looper.loop(Looper.java:123) 12-07 15:52:23.199: ERROR/AndroidRuntime(353): at android.app.ActivityThread.main(ActivityThread.java:4627) 12-07 15:52:23.199: ERROR/AndroidRuntime(353): at java.lang.reflect.Method.invokeNative(Native Method) 12-07 15:52:23.199: ERROR/AndroidRuntime(353): at java.lang.reflect.Method.invoke(Method.java:521) 12-07 15:52:23.199: ERROR/AndroidRuntime(353): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 12-07 15:52:23.199: ERROR/AndroidRuntime(353): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 12-07 15:52:23.199: ERROR/AndroidRuntime(353): at dalvik.system.NativeStart.main(Native Method) 12-07 15:52:23.199: ERROR/AndroidRuntime(353): Caused by: java.lang.ClassNotFoundException: com.jniexample.JNIExample in loader dalvik.system.PathClassLoader[/data/app/com.jniexample-2.apk] 12-07 15:52:23.199: ERROR/AndroidRuntime(353): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) 12-07 15:52:23.199: ERROR/AndroidRuntime(353): at java.lang.ClassLoader.loadClass(ClassLoader.java:573) 12-07 15:52:23.199: ERROR/AndroidRuntime(353): at java.lang.ClassLoader.loadClass(ClassLoader.java:532) 12-07 15:52:23.199: ERROR/AndroidRuntime(353): at android.app.Instrumentation.newActivity(Instrumentation.java:1021) 12-07 15:52:23.199: ERROR/AndroidRuntime(353): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577) 12-07 15:52:23.199: ERROR/AndroidRuntime(353): ... 11 more
can someone please help me out with this?
Are you running NDK4 or NDK5? Your post is dated after NDK5 is out, and it's relevant. We're working to get NDK5 supported, but it will be next month before we release it with Studio 2.1.
-E
Make sure you have a com.jniexample.JNIExample
class in your project, as it appears to be missing. You are not running the original hello-jni
sample, as it has com.example.hellojni.HelloJni
.
精彩评论