title: JNI wierd error only on Samsung A6+ tablet
body: <p>I created an app using the JNI. At one point I need to create a Kotlin object from the C++ world, it works perfectly with the Samsung S7 and my other test phones, but an error is sometimes thrown when I am running the code on a Samsung A6+ Tablet.</p>
  
  <p>I tried to simplify the code as much as possible and run it directly after loading the static library to find out where the error comes from.</p>
  
  <pre><code>//Result class :
  package lib.up.com.library.calibration
  
  class CalibrationResult(val0 : Float, val1 : Float, val2 : Float,
                                val3 : Float, val4 : Float, val5 : Float,
                                val6 : Float, val7 : Float, val8 : Float,
                                var shouldFlip : Boolean, var isReady : Boolean, var cadence : Int) {
      var rotationMatrix : ArrayList&lt;Float&gt; = arrayListOf(val0, val1, val2, val3, val4, val5, val6, val7, val8)
  }
  
  </code></pre>
  
  <pre class="lang-cpp prettyprint-override"><code>//Code in the native class:
  jclass cls = env-&gt;FindClass("lib/up/com/library/calibration/CalibrationResult");
  printf(“Found class”);
  jmethodID methodId = env-&gt;GetMethodID(cls, "&lt;init&gt;", "(FFFFFFFFFZZI)V");
  printf(“Found init method”);
  //Initializing with default values 
  jobject obj = env-&gt;NewObject(cls, methodId,
                       0,
                       0,
                       0,
                       0,
                       0,
                       0,
                       0,
                       0,
                       0,
                       true,
                       false,
                       10);
  
  printf(“Created result object”);
  </code></pre>
  
  <pre><code>
  //Results in the logs :
  
  D/PRINTS: Found class
  D/PRINTS: Found init method
  A/zygote: java_vm_ext.cc:534] JNI DETECTED ERROR IN APPLICATION: unexpected jboolean value: 140
      java_vm_ext.cc:534]     in call to NewObjectV
      java_vm_ext.cc:534]     from void lib.up.com.library.NativeClass.initCalibration(boolean)
  […]
  </code></pre>
  
  <p>Patterns :</p>
  
  <ul>
  <li><p>The unexpected jboolean value can be anything, 96, 140...</p></li>
  <li><p>Sometimes the JNI succeeds to create the CalibrationResult object but never more than 15 times in a row</p></li>
  <li><p>Out of my 4 test devices, the error appears only on the A6+ tablet</p></li>
  <li><p>I am creating other kotlin objects from the JNI in the app that also contain a boolean, their instantiation never crashes on all my test devices</p></li>
  </ul>