I';gradle在命令行上运行jUnit测试时,我得到java.lang.UnsatisfiedLinkError,但在AndroidStudio上运行时,它运行良好

I';gradle在命令行上运行jUnit测试时,我得到java.lang.UnsatisfiedLinkError,但在AndroidStudio上运行时,它运行良好,junit,android-studio,gradle,robolectric,Junit,Android Studio,Gradle,Robolectric,所以我最终设法让我的android studio运行JUnit测试,该测试与robolectric集成,这样我就可以进行http调用和其他事情,而无需在设备或模拟器上运行它。遵循从这里开始的结构,创造了奇迹: 现在,我成功地在AndroidStudio上运行了它,但是我想设置一个cron,这样它就可以自动运行,当通过gradle通过命令行执行测试时,我得到了“java.lang.unsatifiedLinkError:no pjsua in java.library.path”。请注意,我们的代

所以我最终设法让我的android studio运行JUnit测试,该测试与robolectric集成,这样我就可以进行http调用和其他事情,而无需在设备或模拟器上运行它。遵循从这里开始的结构,创造了奇迹:

现在,我成功地在AndroidStudio上运行了它,但是我想设置一个cron,这样它就可以自动运行,当通过gradle通过命令行执行测试时,我得到了“java.lang.unsatifiedLinkError:no pjsua in java.library.path”。请注意,我们的代码使用了我们单独编译的pjsip库代码,并将.so文件放在jniLibs文件夹中。我有另一个jUnit测试,它非常简单,无论是通过gradle命令行还是AndroidStudio,它都可以正常工作

我遵循的gradle命令是:
1) ./gradlew测试——继续

2) ./gradlew test-Dtest.single=test.java

这是应用层的gradle文件的外观:

apply plugin: 'com.android.application'

android {  
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "com.foo.test"
    minSdkVersion 14
    targetSdkVersion 21
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    ndk {
        moduleName "libpjsua"
    }
}

sourceSets {
    main {
        jni.srcDirs = []
    }
}

signingConfigs {
// hidden
}

buildTypes {
    release {
        signingConfig signingConfigs.release
    }
    debug {
    }
}
}

dependencies {  
    compile fileTree(dir: 'libs', include: '*.jar')  
    compile 'com.android.support:appcompat-v7:21.0.3'  
    compile files('libs/android-logging-log4j-1.0.3.jar')  
    compile files('libs/libphonenumber-6.2.jar')  
    compile files('libs/log4j-1.2.17.jar')  
    compile files('libs/nineoldandroids-2.4.0.jar')  
    compile files('libs/ostermillerutils_1_07_00.jar')  

// dependencies to do automation testing
testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-core:1.1'
testCompile 'org.hamcrest:hamcrest-library:1.1'
testCompile 'org.hamcrest:hamcrest-integration:1.1'
testCompile('org.robolectric:robolectric:2.4') {
    exclude module: 'classworlds'
    exclude module: 'commons-logging'
    exclude module: 'httpclient'
    exclude module: 'maven-artifact'
    exclude module: 'maven-artifact-manager'
    exclude module: 'maven-error-diagnostics'
    exclude module: 'maven-model'
    exclude module: 'maven-project'
    exclude module: 'maven-settings'
    exclude module: 'plexus-container-default'
    exclude module: 'plexus-interpolation'
    exclude module: 'plexus-utils'
    exclude module: 'wagon-file'
    exclude module: 'wagon-http-lightweight'
    exclude module: 'wagon-provider-api'
}
}
有人知道吗?非常感谢,我已经在这里呆了几天了