Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find method androidTestCompile() for arguments on project ':app' of type org.gradle.api.Project

Today I installed Android Studio and after opening the program I see this error in the messages Gradle sync part ->


Error:(31, 0) Could not find method androidTestCompile() for arguments [com.android.support.test.espresso:espresso-contrib:2.2.2, build_4zwzygftganlohhaghm2dsums$_run_closure3@7658f1d6] on project ':app' of type org.gradle.api.Project.
<a href="openFile:C:\Users\Dany\AndroidStudioProjects\MyApplication3\app\build.gradle">Open File</a>

and my gradle-module has this code in it ->


apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.dany.myapplication"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
    testCompile 'junit:junit:4.12'
}
androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.2.2'){
    exclude module: 'support-annotations'
    exclude module: 'support-v4'
    exclude module: 'support-v13'
    exclude module: 'recyclerview-v7'
    exclude module: 'appcompat-v7'
}androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.2.2'){
    exclude module: 'support-annotations'
    exclude module: 'support-v4'
    exclude module: 'support-v13'
    exclude module: 'recyclerview-v7'
    exclude module: 'appcompat-v7'
}
like image 408
Daniel Mohajer Avatar asked Sep 13 '25 03:09

Daniel Mohajer


1 Answers

Replacing androidTestCompile with androidTestImplementation in the dependencies block worked for me.

like image 107
Glenn Mascarenhas Avatar answered Sep 14 '25 16:09

Glenn Mascarenhas