Loading a native library in an Android JUnit test

前端 未结 3 694
生来不讨喜
生来不讨喜 2020-12-13 20:49

I\'ve generated a native library using ndk-build which I\'m able to load and use with in my Android application. However, I want to write some tests against thi

3条回答
  •  眼角桃花
    2020-12-13 21:03

    I've switched to the default testing style (using ActivityUnitTestCase instead of RoboElectric) and it's now running fine. It's a shame I have to sacrifice the speed of test running, but running the tests on the emulator actually works. You could also create a shadow class for the JNI class, as detailed here:

    Robolectric tanks on Application objects that load JNI libraries. Can I get a workaround?

    Perhaps compiling the library for my machine would have worked, but I couldn't spend any more time on it.

提交回复
热议问题