Adding Java JNI -Xcheck:jni option to run command in Android Studio

Viewed 205

Newbie question: my app is crashing when it enters my JNI wrapper, and I have read that the Java -Xcheck:jni flag will help to find some coding errors. I don't know how to pass the flag to the run command in Android Studio. I attempted putting the flag at the end of the adb command:

adb shell am start -n "gov.nasa.svgs/gov.nasa.svgs.StartScreen" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -Xcheck:jni

but I suppose that one must specify that it is a Java flag somehow, not an adb flag.
Can anyone tell me how to pass this flag in?

1 Answers

Looks like I can do JNI error checking using the CheckJNI Android mode, detailed in the Extended Checking section of JNI Tips.

The adb command to enable this mode is

adb shell setprop debug.checkjni 1

for a unrooted device.

Related