Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Android Studio 1.1上使用新的测试支持解决单元测试中的NoClassDefFoundError_Android_Unit Testing_Android Studio_Android Gradle Plugin_Android Testing - Fatal编程技术网

如何在Android Studio 1.1上使用新的测试支持解决单元测试中的NoClassDefFoundError

如何在Android Studio 1.1上使用新的测试支持解决单元测试中的NoClassDefFoundError,android,unit-testing,android-studio,android-gradle-plugin,android-testing,Android,Unit Testing,Android Studio,Android Gradle Plugin,Android Testing,使用新的Android构建插件1.1.0-rc 我在src/test下做了一些测试,如果Android框架没有任何依赖项,我也可以做一些测试,但只需要一个简单的Log.d()或Uri.parse抛出一个NoClassDefFoundError 如何修复它?尝试从终端运行/gradlew test,然后在Android Studio中再次运行测试。最后我发现了问题,我需要将这些行添加到我的build.gradle testOptions { unitTests.returnDefaultV

使用新的Android构建插件
1.1.0-rc

我在
src/test
下做了一些测试,如果Android框架没有任何依赖项,我也可以做一些测试,但只需要一个简单的
Log.d()
Uri.parse
抛出一个
NoClassDefFoundError


如何修复它?

尝试从终端运行
/gradlew test
,然后在Android Studio中再次运行测试。

最后我发现了问题,我需要将这些行添加到我的
build.gradle

testOptions {
    unitTests.returnDefaultValues = true
}