The Application
object for my Android app loads a JNI library, and Robolectric doesn\'t seem to like that. When I go to run my tests Robolectric craps out and I
As @Jared pointed out, the solution @Christopher gave doesn't work for Robolectric 2 or 3.
The solution I ended up using was to add the environmental variable:
ROBOLECTRIC=TRUE
to the build configuration for my tests. (Run -> Edit Configurations, Environmental Variables).
Then you check for that environmental variable before loading problematic libraries. For example:
class MyClass {
if(System.getenv("ROBOLECTRIC") == null) {
System.loadLibrary("libname");
}
}
Obviously you won't be able to test any code that relies on that library, but at least some testing will be possibel!