Android Studio. Error:(19,0)

Android Studio. Error:(19,0)

更新AndroidStudio、SDK和工具后出现问题:

Error:(19, 0) Gradle DSL method not found: '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)file:

 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同步:

Error:(19, 0) Gradle DSL method not found: 'android()'

可能的原因:

项目 'pillowNFC-master' 可能正在使用不包含该方法的 Gradle 版本。 -打开Gradle包装文件

构建文件可能缺少 Gradle 插件。 -应用Gradle插件

事件日志:

11:20:46 Gradle 同步开始

11:20:48 Gradle 同步失败:Gradle 未找到 DSL 方法:'android()' 有关详细信息,请参阅 IDE 日志(帮助 | 显示日志)

我知道,之前有人问过这个问题,但是我在另一个讨论中没有找到解决方案=(

如果有人能提供帮助就太好了,我是编程新手。

您使用的 build.gradle 文件有误

在你的顶级文件中你不能使用android块。
还要检查这个 post.

把第一段的这部分删掉build.gradle

android {
    compileSdkVersion 16
   // buildToolsVersion '22.0.1' //23.02.2
}
dependencies {
}

也关注
由于您使用的是 appcompat v23,您必须使用 API23.

进行编译

在您的 module/build.gradle 中将 compileSdkVersion 更改为 23

 compileSdkVersion 23