简体   繁体   中英

Android NDK jni problem

I have started teaching myself about the Android NDK and I have followed this example here - http://marakana.com/forums/android/android_examples/49.html

I have followed the steps perfectly but when I run the application I get the following error:

Trying to load lib /data/data/com.cnetworks.ndk/lib/libndk_demo.so 0x435c2d20
Added shared lib /data/data/com.cnetworks.ndk/lib/libndk_demo.so 0x435c2d20
No JNI_OnLoad found in /data/data/com.cnetworks.ndk/lib/libndk_demo.so 0x435c2d20
+++ not scanning '/system/lib/libwebcore.so' for 'hello' (wrong CL)
+++ not scanning '/system/lib/libmedia_jni.so' for 'hello' (wrong CL)
WARN/dalvikvm(5191): No implementation found for native Lcom/cnetworks/ndk/NativeLib;.hello ()Ljava/lang/String;

Here is the java code, nativeLib.hello() is causing the problem.

public class NDKdemo2 extends Activity {
NativeLib nativeLib;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.main);

 nativeLib = new NativeLib();
 String helloText = nativeLib.hello();

 // Update the UI
 TextView outText = (TextView) findViewById(R.id.textOut);
 outText.setText(helloText);


 }
}

Has anyone had the same problem before and able to tell me whats wrong?

well from my experience there is problem with #define #define attribute (x) defined in some file. Just uncomment the same and then ndk compiled lib will be loaded.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM