开发者

Android NDK jni problem

开发者 https://www.devze.com 2022-12-26 17:17 出处:网络
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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消