Problema do Android NDK JNI
-
25-09-2019 - |
Pergunta
Comecei a me ensinar sobre o Android NDK e segui este exemplo aqui - http://marakana.com/forums/android/android_examples/49.html
Eu segui as etapas perfeitamente, mas quando executo o aplicativo, recebo o seguinte erro:
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;
Aqui está o código Java, nativeLib.hello () está causando o problema.
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);
}
}
Alguém já teve o mesmo problema antes e capaz de me dizer o que está errado?
Solução
Bem, da minha experiência, há problema com #Define #Define atributo(x) definido em algum arquivo. Apenas o descomamento da mesma forma e, em seguida, o NDK compilou LIB será carregado.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow