java - Loading a native library in an Android JUnit test -


i've generated native library using ndk-build i'm able load , use in android application. however, want write tests against part of app.

when calling native function in tests, recieve exception message:

java.lang.unsatisfiedlinkerror: no process in java.library.path 

...where process native library import, named libprocess.so.

i'm using roboelectric tests, , running particular 1 robolectrictestrunner, if makes difference.

how can test project 'see' native library?


edit: i'm loading library in app so:

static {     system.loadlibrary("process"); } public static native int[] process(double[][] data); 

calling process.process(array) works fine in app (the library loaded), fails when run tests exception given above.


edit 2: if set -djava.library.path="<the directory of libprocess.so>" vm argument, then:

system.out.println(system.getproperty("java.library.path")); 

does show path set, still same exception. i'm setting directory as:

<project-name>/libs/x86 

...but absolute path.

i've switched default testing style (using activityunittestcase instead of roboelectric) , it's running fine. it's shame have sacrifice speed of test running, running tests on emulator works. create shadow class jni class, detailed here:

robolectric tanks on application objects load jni libraries. can workaround?

perhaps compiling library machine have worked, couldn't spend more time on it.


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -