0

我已经开始自学有关 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);


 }
}

以前有没有人遇到过同样的问题并且能够告诉我出了什么问题?

4

1 回答 1

1

根据我的经验,某些文件中定义的#define #define属性(x)存在问题。只需取消注释,然后将加载 ndk 编译的 lib。

于 2011-11-12T03:49:54.007 回答