2016-10-12 3 views
0

에 Mockito 종속성을 확인할 수 없습니다 Maven을 저장소로 추가하려고했지만 작동하지 않았습니다.은 Gradle을

편집 : 나는 안드로이드 스튜디오 2.1

를 사용하고 이것은 나의

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' 

} 

build.gradle 응용 프로그램과 나는 해결책을 발견이 글로벌 한

// 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 
} 

답변

2

입니다. 대부분의 자습서에서는 mockito-core를 추가하기 위해 작성되었습니다. mockito-all을 추가하는 대신 실수없이 gradle을 컴파일하여 내 문제를 해결했습니다.