Swe*_*ens 9 mockito android-studio
我尝试在Android Studio 1.2.2中使用Mockito,但是我收到以下错误:
错误:(50,17)无法解决:org.mockito:mockito-core:1.10.19
在手动添加依赖项后同步Gradle时发生错误.这是我的模块Gradle文件中的依赖项:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
testCompile 'org.mockito:mockito-core:1.10.19'
}
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮我解决这个问题吗?
相关问题:
注意:这些评论有助于解决上述问题.然而,它让我陷入另一个我无法解决的问题.但是更新到Android Studio 1.3解决了它.我现在正在Android Studio中运行Mockito.
Hoa*_*han 49
尝试更换testCompile用androidTestCompile,导入库的Mockito当它为我工作.
但是,如果仅包含mockito-core,则可能会遇到运行时错误.你需要加入你的gradle:
androidTestCompile "org.mockito:mockito-core:1.10.19"
androidTestCompile "com.google.dexmaker:dexmaker:1.2"
androidTestCompile "com.google.dexmaker:dexmaker-mockito:1.2"
Run Code Online (Sandbox Code Playgroud)
如果您有dexcache错误,请将此行放入您的setUp()(假设您正在使用InstrumentalTestCase)
System.setProperty("dexmaker.dexcache", getInstrumentation().getTargetContext().getCacheDir().getPath());
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10556 次 |
| 最近记录: |