【发布时间】:2016-10-12 20:54:38
【问题描述】:
虽然我看到两个不同的帖子都带有此错误消息,但对我没有任何帮助:
错误:(25, 17) 无法解决:org.mockito:mockito-core:1.10.19
我尝试使用 compile、androidTestCompile 和 testCompile 更改 Mockito 依赖项,并在全局 Gradle 文件中尝试将 Maven 添加为存储库,但没有成功。
编辑:我使用的是 Android Studio 2.1
这是我的应用 build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "ivano.android.com.mockitoexample"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
}
这是全球性的
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
【问题讨论】:
标签: android unit-testing testing gradle mockito