title: Android's CheckJNI: How to turn it off/on (on an emulator)? Documentation seems to be faulty
body: <p>I have spent some time examining the checkjni mode using an Android emulator with my app.
  Altough it is written (in <a href="http://android-developers.blogspot.com/2011/11/jni-local-reference-changes-in-ics.html" rel="nofollow">http://android-developers.blogspot.com/2011/11/jni-local-reference-changes-in-ics.html</a>) that CheckJNI is on by default if debuggable="true" &amp; targetSdkVersion is at least Ice Cream Sandwich (in the AndroidManifest.xml file) - The debug output dump of the CheckJNI (warning and errors) is still printed in the DDMS, even if i use a Gingerbread values and install it on a Gingerbread emulator.</p>
  
  <p>The only difference that i have found is that CheckJNI warnings on an Ice Cream Sandwich emulator (no matter what were the values in my AndroidManifest.xml file) will cause the app to crash with the respected warning - while they would only be printed in a Gingerbread emulator (I have tested a DeleteGlobalRef used on local reference to induce this warning).</p>
  
  <p>There are two non-informational logs that are printed in accordance to the AndroidManifest.xml - But the logs of the of the CheckJNI mode are not affected.</p>
  
  <p>Here are the logs -</p>
  
  <p><strong>#On ICS emulator</strong>
  <em>After Installing the app:</em></p>
  
  <pre><code> 01-19 08:43:01.491: D/AndroidRuntime(32): CheckJNI is ON
  
  Loading the app:
  01-19 08:32:26.617: D/dalvikvm(590): Not late-enabling CheckJNI (already on)
  
  (The last line is printed only when debuggable="true")
  
  01-19 08:32:27.066: I/dalvikvm(590): Turning on JNI app bug workarounds for target SDK version 10...
  
  (The last line is printed only when targetSdkVersion=10)
  </code></pre>
  
  <p>On error code (crash):</p>
  
  <pre><code>01-19 08:37:56.176: W/dalvikvm(651): JNI WARNING: DeleteGlobalRef on non-global 0x41339550 (type=1)
  
  ...
  
  01-19 08:37:56.187: E/dalvikvm(651): VM aborting
  
  01-19 08:37:56.187: A/libc(651): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1)
  </code></pre>
  
  <p><strong>#On Gingerbread:</strong></p>
  
  <p><em>After Installing the app:</em></p>
  
  <pre><code>01-19 08:43:01.491: D/AndroidRuntime(32): CheckJNI is ON
  
  Loading the app:
  </code></pre>
  
  <p>No important logs</p>
  
  <p>On error code (no crash):</p>
  
  <pre><code>01-19 08:45:20.079: W/dalvikvm(304): JNI: DeleteGlobalRef(0x40608718) failed to find entry (valid=1)
  </code></pre>
  
  <p>So my question is how should i turn it on/off - and how should it affect the application (or the logs) differently when on?</p>
  
  <p>Thanks.</p>