【发布时间】:2016-03-11 22:24:18
【问题描述】:
更新Android Studio、SDK和工具后出现问题:
错误:(19, 0) Gradle DSL 方法未找到:'android()'
请帮忙解决:
顶部 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.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
android {
compileSdkVersion 16
// buildToolsVersion '22.0.1' //23.02.2
}
dependencies {
}
另一个build.gradle(Module:app)文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 16
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.mateuyabar.android.pillownfc"
minSdkVersion 10
targetSdkVersion 23
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:23.0.0'
}
这是 Gradle Sync 的错误消息:
错误:(19, 0) Gradle DSL 方法未找到:'android()'
可能的原因:
项目“pillowNFC-master”可能正在使用不包含该方法的 Gradle 版本。 -打开 Gradle 包装文件
构建文件可能缺少 Gradle 插件。 - 应用 Gradle 插件
事件日志:
11:20:46 Gradle 同步开始
11:20:48 Gradle 同步失败:未找到 Gradle DSL 方法:'android()' 查看 IDE 日志了解更多详情(帮助 | 显示日志)
我知道,之前有人问过这个问题,但是我在其他讨论中没有找到解决方案 =(
如果有人能帮忙就好了,我是编程新手。
【问题讨论】:
标签: android android-studio gradle android-gradle-plugin build.gradle