No JNI_Onload () found and shutdown VM

I am new to Android, I followed the instructions at http://marakana.com/forums/android/examples/49.html to create the main application using the NDK.

I have definitely completed these steps. I also created a shared library. When I launch the application, CatLog shows the following errors:

Trying to load lib /data/data/com.example.NDKDemo/lib/libndk_demo.so 0x4129dc18
01-30 04:50:58.856: D/dalvikvm(586): Added shared lib
                    /data/data/com.example.NDKDemo/lib/libndk_demo.so 0x4129dc18
01-30 04:50:58.856: D/dalvikvm(586): No JNI_OnLoad found in 
                    /data/data/com.example.NDKDemo/lib/libndk_demo.so 0x4129dc18,
                    skipping init
01-30 04:50:58.866: D/AndroidRuntime(586): Shutting down VM
01-30 04:50:58.866: W/dalvikvm(586): threadid=1: thread exiting with uncaught 
                    exception (group=0x409c01f8)
01-30 04:50:58.896: E/AndroidRuntime(586): FATAL EXCEPTION: main
01-30 04:50:58.896: E/AndroidRuntime(586): java.lang.RuntimeException:
                    Unable to instantiate activity ComponentInfo
                    {com.example.NDKDemo/com.example.NDKDemo.NativeLib}:
                    java.lang.ClassCastException:
                    com.example.NDKDemo.NativeLib cannot be cast to android.app.Activity
+5
source share
1 answer

As already mentioned, JNI_OnLoad is not required. Here is your problem:

Unable to instantiate activity ComponentInfo {Com.example.NDKDemo / com.example.NDKDemo.NativeLib}: java.lang.ClassCastException: com.example.NDKDemo.NativeLib cannot be added to android.app.Activity

NDK, : com.example.NDKDemo.NativeLib android.app.Activity.

, AndroidManifest.xml, , Activity. NDKDemo, , , AndroidManifest.xml:

<activity android:name="NDKDemo" ... other options ... >
+1

All Articles