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.
精彩评论