gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 05:01:11 25 4
gpt4 key购买 nike

我在Android Studio中打开一个 friend 项目,我的AS版本大于他的版本。
这是错误:

Error:(27, 0) Gradle DSL method not found: 'android()'
Possible causes:The project 'firstapp' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file The build file may be missing a Gradle plugin.
Apply 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:2.2.0-alpha1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

android {
compileSdkVersion 19
buildToolsVersion '21.0.0'
}
dependencies {
}

我该如何解决此问题?

最佳答案

从官方文档看这里。
https://developer.android.com/studio/build/index.html

/**
 * The first line in the build configuration applies the Android plugin for
 * Gradle to this build and makes the android {} block available to specify
 * Android-specific build options.
 */

apply plugin: 'com.android.application'

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

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