Septik Argonot
Septik Argonot

Reputation: 225

Android Studio 3.3: Gradle Build Sync message is error FAILURE: Build failed with an exception

ERROR: Could not find method testImplementation() for arguments [junit:junit:4.12] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

I updated the android studio yesterday and created a new project but error during the gradle sync synchronization.

FAILURE: Build failed with an exception.

CONFİGURE FAILED in 25s ERROR: Could not find method testImplementation() for arguments [junit:junit:4.12] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. Open File

buildscript
{
    repositories {
        google()
        jcenter()  
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0' } 
}
allprojects { 
    repositories { 
        google() 
        jcenter() 
    }
}

and my gradle properties

distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

and my gradle build

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.denemeuygulamasi.dnm"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

Upvotes: 0

Views: 3974

Answers (2)

androboy
androboy

Reputation: 586

Today I had same issue , after update to 3.3

I uninstall and delete gradle directory android directory etc nothing worked but then I wrote

testİmplementation instead of testImplementation and androidTestİmplementation

it worked basically , I don't know why , but you can try and write if you find better solution please because I have to do this to every project I create

Upvotes: 1

Khaled Qasem
Khaled Qasem

Reputation: 929

Did you add it's dependency?

I think you need to add in build gradle dependencies

testImplementation 'junit:junit:4.12'

Or delete .gradle and .idea then invalidate cache and restart enter image description here

Upvotes: 1

Related Questions