title: Android NDK crash in CallObjectMethod calling static method with ART
body: <p>In an Android app I have some JNI code that calls a java static method.</p>
  
  <pre><code>jbyteArray response = (jbyteArray)pEnv-&gt;CallObjectMethod(handlerClass, mid, jstrServiceUrl, jstrRequest);
  </code></pre>
  
  <p>Executing it in Android 5 in an <strong>ART</strong> environment, I get a <em>check jni</em> error:</p>
  
  <blockquote>
    <p>JNI DETECTED ERROR IN APPLICATION: calling static method byte[] x.y.z(java.lang.String, java.lang.String) with CallObjectMethodV in call to CallObjectMethodV...</p>
  </blockquote>
  
  <p>I don't get this error in Android 4 with a <strong>Dalvik</strong> environment.</p>
  
  <p>The java method is this one:</p>
  
  <pre><code>public static byte[] z(String serviceURL, String request) 
  </code></pre>
  
  <p>and is previously binded like this:</p>
  
  <pre><code>jclass handlerClass = pEnv-&gt;FindClass("x/y/z");
  if (handlerClass == NULL) {
      return -1;
  }
  
  mid = pEnv-&gt;GetStaticMethodID(handlerClass, "z", "(Ljava/lang/String;Ljava/lang/String;)[B");
  if (mid == NULL) {
      return -2;
  }
  
  // Construct Strings
  jstring jstrServiceUrl = pEnv-&gt;NewStringUTF(szServiceURL);
  jstring jstrRequest = pEnv-&gt;NewStringUTF(szRequest);
  </code></pre>