Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find method implementation() for arguments [directory 'libs'] on object

Error Message:- Could not find method implementation() for arguments [directory 'libs'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Code

apply plugin: 'com.android.application'

ext {
    supportVersion='27.1.1'
}
android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.eassycars.www.dlservices"
        minSdkVersion 17
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    buildscript {
        repositories {
            jcenter()
        }
        configure(':app') {
        dependencies {
            classpath 'com.android.tools.build.gradle:4.8.1'
            implementation fileTree (include: ['*.jar'], dir: 'libs')
            implementation "com.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler :$supportVersion"
            implementation "com.android.support:appcompat-v7:$supportVersion"
            implementation "com.android.support:cardview-v7:$supportVersion"
            implementation "com.android.support:recyclerview-v7:$supportVersion"
            implementation "com.android.support:design:$supportVersion"
            implementation "com.android.support:palette-v7:$supportVersion"
            implementation "com.android.support:customtabs:$supportVersion"
            implementation "com.android.support:support-v4:$supportVersion"
            implementation 'com.google.android.exoplayer:exoplayer:r2.0.4'
            // utils
            implementation 'com.github.bumptech.glide:glide:4.0.0'
            annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
            implementation 'com.koushikdutta.ion:ion:2.1.7'
            implementation 'com.github.Commit451:bypasses:1.0.4'
            implementation 'com.jakewharton:butterknife:8.8.0'
            annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.0'
            implementation 'com.drewnoakes:metadata-extractor:2.9.1'
            implementation 'com.orhanobut:hawk:2.0.1'
            classpath 'com.google.gms:google-services:3.1.1'
            implementation 'com.android.support:support-annotations:27.1.1'
        }}
    }
}
like image 660
Gears2Apps Avatar asked Jul 02 '18 13:07

Gears2Apps


People also ask

Could not find method compile () for arguments react native?

You can fix this issue by replacing compile with implementation in node_modules/react-native-geocoder/android/build. gradle.

What is dependencyResolutionManagement?

The dependencyResolutionManagement repositories block accepts the same notations as in a project, which includes Maven or Ivy repositories, with or without credentials, etc. By default, repositories declared by a project will override whatever is declared in settings.

What is the build gradle file?

gradle. Gradle is a build system (open source) that is used to automate building, testing, deployment, etc.


1 Answers

I updated the "distributionUrl in my "gradle/wrapper/gradle-wrapper.properties" file to match the current gradle version.

I also updated the classpath in my top level build.gradle file to match the gradle API level.

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

Re-synced and then it built OK.

like image 162
philburk Avatar answered Sep 29 '22 08:09

philburk