title: Crash while calling NewStringUTF()
body: <p>I'm writing a JNI to call a C++ code from Java. it has been crashed when I used <em>NewStringUTF()</em> . Here is my code:</p>
  
  <pre><code>__android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "The value of 3 is %d", 3);
  __android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "The value of id is %s", id.c_str());
  
  jstring jsId = m_env-&gt;NewStringUTF(id.c_str());// CODE CRASHES HERE
  
  __android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "The value of 4 is %d", 4);
  </code></pre>
  
  <p>And output is :</p>
  
  <pre><code>V/myapplication ( 4930): The value of 3 is 3
  V/myapplication( 4930): The value of id is 999999999999@example.example.net
  F/art     ( 4930): art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: thread Thread[12,tid=5100,Native,Thread*=0xa1033400,peer=0x12c5b0e0,"QtThread"] using JNIEnv* from thread Thread[17,tid=5359,Runnable,Thread*=0xb4e0ac00,peer=0x12e37080,"Thread-161252"]
  F/art     ( 4930): art/runtime/check_jni.cc:65]     in call to NewStringUTF
  F/art     ( 4930): art/runtime/check_jni.cc:65]     from void
  </code></pre>
  
  <p>It was crashed while I debugging on Android 5 but it's ok with lower version.
  any suggestion?</p>
  
  <p>EDITED: I changed m_env. here is my code :</p>
  
  <pre><code>JNIEnv *env = NULL;
  __android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "The value of 3 is %d", 3);
  __android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "The value of jid is %s", jid.c_str());
  
  jstring jsJid = env-&gt;NewStringUTF(jid.c_str());
  __android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "The value of 4 is %d", 4);
  </code></pre>
  
  <p>and output is :</p>
  
  <pre><code>F/libc    (28181): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 28354 (QtThread)
  </code></pre>