错误(19,0)Gradle 未找到 DSL 方法:android()
Error(19,0) Gradle DSL method not found: android()
我刚刚 升级了 android studio,之前编译的项目现在显示 错误!
Error(19,0) Gradle DSL method not found: android()
,这是构建脚本和 app.build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 22
}
productFlavors {
}
}
dependencies {
}
这里是 build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.aqsa.personal.newpro"
minSdkVersion 8
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:21.0.3'
}
Here is the build script and app.build.gradle
从顶级 build.gradle
文件中删除 allprojects
关闭后的所有内容,留下:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
android
闭包尤其需要位于使用 Gradle 之一的模块中用于 Android 插件(例如 com.android.application
)。
从第一个代码中删除它
android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 22
}
productFlavors {
}
}
见
问题:
Error:(19, 0) Gradle DSL method not found: 'android()'
解法:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
allprojects {
repositories {
jcenter()
}
}
删除所有项目代码后,构建 project.this 解决方案适合我。
我刚刚 升级了 android studio,之前编译的项目现在显示 错误!
Error(19,0) Gradle DSL method not found: android()
,这是构建脚本和 app.build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 22
}
productFlavors {
}
}
dependencies {
}
这里是 build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.aqsa.personal.newpro"
minSdkVersion 8
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:21.0.3'
}
Here is the build script and app.build.gradle
从顶级 build.gradle
文件中删除 allprojects
关闭后的所有内容,留下:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
android
闭包尤其需要位于使用 Gradle 之一的模块中用于 Android 插件(例如 com.android.application
)。
从第一个代码中删除它
android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 22
}
productFlavors {
}
}
见
问题:
Error:(19, 0) Gradle DSL method not found: 'android()'
解法:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
allprojects {
repositories {
jcenter()
}
}
删除所有项目代码后,构建 project.this 解决方案适合我。