我的 Android 应用程序的Application
对象加载了一个 JNI 库,而 Robolectric 似乎不喜欢这样。当我去运行我的测试时,Robolectric 胡扯了,我得到了这个堆栈跟踪:
java.lang.UnsatisfiedLinkError: java.lang.ClassLoader.loadLibrary(ClassLoader.java:1758) 处 java.lang.Runtime.loadLibrary0(Runtime.java:823) 处 java.library.path 中没有 cperryinc-jni .System.loadLibrary(System.java:1045) 在 com.cperryinc.application.MoolaApplication.(MoolaApplication.java:24) 在 java.lang.Class.forName0(Native Method) 在 java.lang.Class.forName(Class. java:169) at com.xtremelabs.robolectric.internal.ClassNameResolver.safeClassForName(ClassNameResolver.java:36) at com.xtremelabs.robolectric.internal.ClassNameResolver.resolve(ClassNameResolver.java:15) at com.xtremelabs.robolectric.ApplicationResolver .newApplicationInstance(ApplicationResolver.java:71) 在 com.xtremelabs.robolectric.ApplicationResolver.resolveApplication(ApplicationResolver.java:28) 在 com.xtremelabs。robolectric.RobolectricTestRunner.createApplication(RobolectricTestRunner.java:483) at com.xtremelabs.robolectric.RobolectricTestRunner.setupApplicationState(RobolectricTestRunner.java:360) at com.xtremelabs.robolectric.RobolectricTestRunner.internalBeforeTest(RobolectricTestRunner.java:299) at com.xtremelabs .robolectric.RobolectricTestRunner.methodBlock(RobolectricTestRunner.java:277) 在 org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79) 在 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71) 在 org. junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)在 org.junit.runners.ParentRunner。runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.junit.runners .ParentRunner.run(ParentRunner.java:236) at org.junit.runner.JUnitCore.run(JUnitCore.java:157) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76) at com.intellij。 rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:182) 在 com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:62) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 在 com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.junit.runners.ParentRunner.run(ParentRunner.java:236)在 org.junit.runner.JUnitCore.run(JUnitCore.java:157) 在 com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76) 在 com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter .java:182) 在 com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:62) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java :39) 在 com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.junit.runners.ParentRunner.run(ParentRunner.java:236)在 org.junit.runner.JUnitCore.run(JUnitCore.java:157) 在 com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76) 在 com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter .java:182) 在 com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:62) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java :39) 在 com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)ParentRunner$2.evaluate(ParentRunner.java:184) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.junit.runner.JUnitCore.run(JUnitCore.java:157) at com.intellij。 junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76) 在 com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:182) 在 com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter. java:62) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 在 com.intellij.rt.execution.application.AppMain.main(AppMain.java: 120)ParentRunner$2.evaluate(ParentRunner.java:184) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.junit.runner.JUnitCore.run(JUnitCore.java:157) at com.intellij。 junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76) 在 com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:182) 在 com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter. java:62) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 在 com.intellij.rt.execution.application.AppMain.main(AppMain.java: 120)junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76) 在 com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:182) 在 com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter. java:62) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 在 com.intellij.rt.execution.application.AppMain.main(AppMain.java: 120)junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76) 在 com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:182) 在 com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter. java:62) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 在 com.intellij.rt.execution.application.AppMain.main(AppMain.java: 120)在 com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) 调用(NativeMethodAccessorImpl.java:39)在 com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) 调用(NativeMethodAccessorImpl.java:39)
我不确定我能做些什么。关于解决方法的任何想法?