title: JNI GetMethodID called with pending exception java.lang.ClassNotFoundException
body: <p>I am developing an android library (.aar) which has mainly native code and bit of java code mainly to provide java interface to the application code.</p>
  
  <p>I have a demo app which utilizes the library and everything works fine.</p>
  
  <p>Now I am giving this library someone who is supposed to be an OEM. They are developing a (system) app which utilizes this library. In their case the native library throw exception in the following code.</p>
  
  <pre><code>shapeClass = env-&gt;FindClass("xx/yy/zz/Shape");
  addMethod = env-&gt;GetMethodID(shapeClass, "addPoint", "(FF)V");
  </code></pre>
  
  <p>This is the error they get</p>
  
  <pre><code>JNI DETECTED ERROR IN APPLICATION: JNI GetMethodID called with pending exception java.lang.ClassNotFoundException: Didn't find class "xx.yy.zz.Shape" on path: DexPathList[[zip file "/system/app/AA/AA.apk"],nativeLibraryDirectories=[/system/app/AA/lib/arm, /system/app/AA/AA.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib, /system/lib, /vendor/lib]]
  </code></pre>
  
  <p>I googled and did not find much on what differs in the system app. How a system app environment is different than a regular app environment? </p>
  
  <p>Please note that above two lines of the code are called from the java wrapper code through JNI interface. So there is no chance that the (Shape) class is not loaded because Shape class and invoking class are in the same library (same .aar file). </p>