我已经开始自学Android NDK了,我在这里遵循了这个例子 - http://marakana.com/forums/android/android_examples/49.html
我已经完美地遵循了这些步骤,但是当我运行应用程序时,我收到以下错误:
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;
这是java代码,nativeLib.hello()导致问题。
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);
}
}
之前有没有人遇到过同样的问题并能告诉我什么是错的?
答案 0 :(得分:1)
根据我的经验,某些文件中定义的#define #define 属性(x)存在问题。 只需取消注释即可,然后将加载ndk编译的lib。