I got the hello-jni sample to run on my emulator and it will say "Hello from JNI !" via hell-jni.c. However when I change
return (*env)->NewStringUTF(env, "Hello from JNI !开发者_运维百科");
to
return (*env)->NewStringUTF(env, "Hello from TEST !");
Then I close my emulator, open it back up I will not see the string update. I tried to do Project -> Clean, then run it again and it will not update. Does anyone know why?
You have changed the native code. So just by clean and run you will not get the effect.
If you change the native code you need to build the native library again. Need to make the make the native library using NDK
Labeeb is right, so you basically should recompile your native code. For this go to:
cd <ndk-root>/samples/hello-jni
and simply type:
ndk-build clean
ndk-build
If you already have added the path to the ndk-build script to your $PATH enviroment variable.
精彩评论