错误(19,0)未找到Gradle DSL方法:android()

hye*_*eri 3 android android-gradle-plugin

我刚刚升级了android studio,之前编译的项目现在显示错误!

错误(19,0)未找到Gradle DSL方法: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 {
}
Run Code Online (Sandbox Code Playgroud)

这是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'
}
Run Code Online (Sandbox Code Playgroud)

Com*_*are 7

这是构建脚本和app.build.gradle

allprojects顶级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()
}
}
Run Code Online (Sandbox Code Playgroud)

所述android封闭件,特别是,需要将正在使用该摇篮之一为Android插件(例如,在一个模块中com.android.application).