English 中文(简体)
Android - How to enable CheckJni for NDK development?
原标题:

Can someone please tell me if I m missing something here? I am trying the following commands in shell.

$ ./adb shell stop
$ ./adb shell setprop dalvik.vm.checkjni true
$ ./adb shell start

But Logcat always shows "CheckJNI is OFF" when I install the apk onto the device.
Is there something else in eclipse that I need to do to enable the XCheck:Jni flag?

Thanks for any help BD

问题回答

There is four different cases, one for rooted device, one for emulator, one for regular device and one for rooted or regular device.


On rooted device I was able to get it working so:

In adb:

adb shell

In launched after this shell:

su
stop
setprop dalvik.vm.checkjni true
start

After this device was rebooted and at boot I see log message:

CheckJNI is ON



For other cases see some theory from official docs:

There are several ways to enable CheckJNI.

If you’re using the emulator, CheckJNI is on by default.

If you have a rooted device, you can use the following sequence of commands to restart the runtime with CheckJNI enabled:

adb shell stop
adb shell setprop dalvik.vm.checkjni true
adb shell start

In either of these cases, you’ll see something like this in your logcat output when the runtime starts:

D AndroidRuntime: CheckJNI is ON

If you have a regular device, you can use the following command:

adb shell setprop debug.checkjni 1

This won’t affect already-running apps, but any app launched from that point on will have CheckJNI enabled. (Change the property to any other value or simply rebooting will disable CheckJNI again.) In this case, you’ll see something like this in your logcat output the next time an app starts:

D Late-enabling CheckJNI

You can also set the android:debuggable attribute in your application s manifest to turn on CheckJNI just for your app. Note that the Android build tools will do this automatically for certain build types.

There is a section on how to use checkJNI here too:

http://www.netmite.com/android/mydroid/dalvik/docs/embedded-vm-control.html





相关问题
Eclipse: Hover broken in debug perspective

Since upgrading Eclipse (Galileo build 20090920-1017), hover in debug no longer displays a variable s value. Instead, hover behaves as if I were in normal Java perspective: alt text http://...

IIS 6.0 hangs when serving a web-service

I am having issues with one of our web-services. It works fine on my development machine (win XP) whether I host it as a separate application or using cassini from Visual studio. Once I deploy on the ...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Asp.Net MVC - Problem returning a model to the view

I ve recently started using the Areas functionality of the Preview2 and it was working ok until I needed to return a Model to the view. Controller: public ActionResult ForgotPassword() { return ...

Unable to generate PDB files in Visual Studio 2005

For most assemblies, I m able to generate their respective .pdb files. However, I ve got one project that isn t generating their .pdb files. I ve made sure that it on debug mode and that the project ...

热门标签