Home > database >  Full error : Could not find method compile() for arguments [directory 'libs'] on object of
Full error : Could not find method compile() for arguments [directory 'libs'] on object of

Time:04-30

Full error: Could not find method compile() for arguments [directory 'libs'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler :23

This is my Gradle file. It is "gradle.build":

apply plugin: 'com.android.application'

android {
    compileSdk 32
    buildToolsVersion '32.1.0 rc1'

    defaultConfig {
        applicationId "com.example.amedina.helloworld"
        minSdkVersion 15
        targetSdkVersion 22
        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:22.1.1'
}

CodePudding user response:

To fix it, change compile to implementation like this:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:22.1.1'
}
  • Related