2016-12-30 1 views
2

Pluralsight에서 Start Developing for Android 과정을 밟고 있습니다. 테스트를 추가하려고합니다. 지침은 build.gradle 파일에 androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'을 추가하는 말 :요람 빌드 방법을 찾을 수 없습니다

// 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.2.1' 

    // NOTE: Do not place your application dependencies here; they belong 
    // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
    jcenter() 
    } 

    dependencies { 
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' 
    } 
} 

이 일 후 인 IntelliJ가 Gradle을 파일이 변경되었습니다, 그것은 다시 동기화 할 필요가 있음을 알려줍니다. 내가 할 때 나는 다음과 같은 오류가 있지만 :

오류 :

15:17 Gradle sync failed: Could not find method androidTestCompile() for arguments [com.android.support.test.espresso:espresso-core:2.2.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. 
      Consult IDE log for more details (Help | Show Log) 

NB : 나는 버전 2.2.12.2.2을 시도했다.

여기 무슨 일 이니?

감사

답변

1

의존성은 app 모듈 build.gradle에 첨가되어야한다. 귀하의 경우 부모 프로젝트 build.gradle에 추가했습니다.

+0

감사합니다. Andy, 나는 다른 오류가 발생하는대로 follow up 질문을 가지고 있습니다. [여기] (http://stackoverflow.com/questions/41399724/cannot-find-androidtestcompile-on-android-build). 당신도 그걸보실 수 있습니까? 감사. – BanksySan

관련 문제