Android NDK JNI problème
-
25-09-2019 - |
Question
J'ai commencé à enseigner moi-même sur l'Android NDK et j'ai suivi cet exemple ici - http://marakana.com/forums/android/android_examples/49.html
Je l'ai suivi les étapes parfaitement, mais quand je lance l'application, je reçois l'erreur suivante:
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;
Voici le code java, nativeLib.hello () est à l'origine du problème.
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);
}
}
Quelqu'un at-il eu le même problème avant et capable de me dire ce qui est erroné?
La solution
bien de mon expérience, il y a un problème #define #define attribut (x) définie dans un certain fichier. Juste décommenter le même et ndk lib compilé sera chargé.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow