title: Loading a native library in an Android JUnit test
body: <p>I've generated a native library using <code>ndk-build</code> which I'm able to load and use with in my Android application. However, I want to write some tests against this part of my app.</p>
  
  <p>When calling the native function in my tests, I recieve this exception message:</p>
  
  <pre><code>java.lang.UnsatisfiedLinkError: no process in java.library.path
  </code></pre>
  
  <p>...where <code>process</code> is my native library to import, named <code>libprocess.so</code>.</p>
  
  <p>I'm using Roboelectric for my tests, and running this particular one with the <code>RobolectricTestRunner</code>, if it makes a difference.</p>
  
  <p>How can I get my test project to 'see' the native library?</p>
  
  <hr>
  
  <p><strong>Edit:</strong>
  I'm loading the library in my app like so: </p>
  
  <pre><code>static {
      System.loadLibrary("process");
  }
  public static native int[] process(double[][] data);
  </code></pre>
  
  <p>calling <code>Process.process(array)</code> works fine in the app (the library is loaded), but fails when run from the tests with the exception given above.</p>
  
  <hr>
  
  <p><strong>Edit 2:</strong>
  If I set <code>-Djava.library.path="&lt;the directory of libprocess.so&gt;"</code> as a VM argument, then:</p>
  
  <pre><code>System.out.println(System.getProperty("java.library.path"));
  </code></pre>
  
  <p>does show the path I set, but I still get the same exception. I'm setting the directory as:</p>
  
  <pre><code>&lt;project-name&gt;/libs/x86
  </code></pre>
  
  <p>...but as an absolute path.</p>