当前位置:  开发笔记 > 编程语言 > 正文

如何在使用Robolectric时加载.so?

如何解决《如何在使用Robolectric时加载.so?》经验,为你挑选了0个好方法。

W/Environment:EXTERNAL_STORAGE undefined; 回到默认状态

java.lang.UnsatisfiedLinkError: com.autonavi.amap.mapcore.MapCore.nativeNewInstance(Ljava/lang/String;)J
    at com.autonavi.amap.mapcore.MapCore.nativeNewInstance(Native Method)
    at com.autonavi.amap.mapcore.MapCore.(MapCore.java:62)
    at com.amap.api.mapcore.AMapDelegateImpGLSurfaceView.(AMapDelegateImpGLSurfaceView.java:356)
    at com.amap.api.mapcore.AMapDelegateImpGLSurfaceView.(AMapDelegateImpGLSurfaceView.java:318)
    at com.amap.api.mapcore.ak.a(MapFragmentDelegateImp.java:123)
    at com.amap.api.maps.MapView.onCreate(MapView.java:131)
    at com.e.activity.DriverReleaseActivity.initData(DriverReleaseActivity.java:179)
    at com.e.base.BaseActivity.onCreate(BaseActivity.java:29)
    at android.app.Activity.performCreate(Activity.java:5933)
    at org.robolectric.util.ReflectionHelpers.callInstanceMethod(ReflectionHelpers.java:195)
    at org.robolectric.util.ActivityController$1.run(ActivityController.java:122)
    at org.robolectric.shadows.ShadowLooper.runPaused(ShadowLooper.java:304)
    at org.robolectric.shadows.CoreShadowsAdapter$2.runPaused(CoreShadowsAdapter.java:45)
    at org.robolectric.util.ActivityController.create(ActivityController.java:118)
    at org.robolectric.util.ActivityController.create(ActivityController.java:129)
    at com.enjoytech.ecar.carpooling.activity.DriverReleaseAcitivityTest.init(DriverReleaseAcitivityTest.java:87)
    at com.enjoytech.ecar.carpooling.activity.DriverReleaseAcitivityTest.test(DriverReleaseAcitivityTest.java:79)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:251)
    at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:188)
    at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:54)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:152)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

进程以退出代码-1结束

它无法加载.so文件.

我用的时候

try {      
    System.loadLibrary("libamapv304");
    System.loadLibrary("libamapv304ex");
} catch (UnsatisfiedLinkError e) {
    e.printStackTrace();
}

它导致 java.lang.UnsatisfiedLinkError: no libamapv304 in java.library.path

如何使用.soRoboletric完成单元测试?

推荐阅读
郑谊099_448
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有