gpt4 book ai didi

android - 找不到 Gradle DSL 方法 : compile()

转载 作者:行者123 更新时间:2023-11-30 02:26:04 24 4
gpt4 key购买 nike

我使用的IDE是android studio 1.0.2版本。

我收到以下错误:

Gradle DSL method not found: 'compile()'
Error(0,9): The project 'MiarrayAdapter' may be using a version
of Gradle that does not contain the method
the built file may be missing a Gradle plugin

我的文件 build.gradle 是:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
compile 'com.android.support:appcompat-v7:+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

我还有其他文件 build.gradle (Module app),代码是:

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "com.cursoandroid.miarrayadapter"
minSdkVersion 6
targetSdkVersion 21
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:+'
}


allprojects {
repositories {
jcenter()
}
}

最佳答案

从顶级 build.gradle 中删除以下内容:

compile 'com.android.support:appcompat-v7:+'

还要注意那里的评论:

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

关于android - 找不到 Gradle DSL 方法 : compile(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27896427/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com