Full error : Could not find method compile() for arguments [directory 'libs'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.Def
Full error : Could not find method compile() for arguments [directory 'libs'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.Def
完整错误:
无法在 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 类型的对象上找到参数 [目录 'libs'] 的方法 compile() :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'
}
要修复它,请将 compile
更改为 implementation
,如下所示:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:22.1.1'
}
完整错误: 无法在 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 类型的对象上找到参数 [目录 'libs'] 的方法 compile() :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'
}
要修复它,请将 compile
更改为 implementation
,如下所示:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:22.1.1'
}