android 完整错误:在类型为org.gradle.API.internal.artifacts. website.dependencies.Def的对象上找不到参数[目录“libs”]的方法compile()

wpcxdonn  于 2023-10-14  发布在  Android
关注(0)|答案(2)|浏览(105)

完全错误:找不到用于org.gradle.API.internal.artifacts.api.dependencies类型的对象上的参数[目录“libs”]的方法compile()。DefaultDependencyError:23
这是我的Gradle文件。它是“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'
}
vngu2lb8

vngu2lb81#

要修复它,请将compile更改为implementation,如下所示:

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

gblwokeq2#

要解决此问题,请将“compile”修改为“implementation”,如以下代码片段所示:

implementation 'com.google.android.gms:play-services-wearable:18.1.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation "com.google.android.gms:play-services-location:18.0.0"

相关问题