Android studio Android studio生成脚本错误,找到不支持的gradle DSL方法:Android()!

Android studio Android studio生成脚本错误,找到不支持的gradle DSL方法:Android()!,android-studio,Android Studio,我将Android Studio升级为AS 0.6,然后导入了在AS 0.3中开发的项目 我遇到了如下错误: Build script error,unsupported Gradle DSL method found : android()'!, Possible causes could be: - you are using Gradle version where the method is absent ("open_gradle_settings">Fix

我将Android Studio升级为AS 0.6,然后导入了在AS 0.3中开发的项目

我遇到了如下错误:

Build script error,unsupported Gradle DSL method found : android()'!,

Possible causes could be:  

 - you are using Gradle version where the method is absent 
    ("open_gradle_settings">Fix Gradle settings</a>)

 - you didn't apply Gradle plugin which provides the method 
    (<a href="apply_gradle_plugin">Apply Gradle plugin</a>)

or there is a mistake in a build script (<a href="goto_source">Goto source</a>)
有什么问题吗


是否有任何指南说明如何升级项目?

事实上,它在错误消息中已说明。所以只要加上

apply plugin: 'com.android.application'

依赖项
部分和
android
部分之间

将“gradledsl方法”视为一种Java方法。所以在Gradle中,方法可以通过{}或“.”来区分。所以

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

dependencies.compile fileTree(dir: 'libs', include: ['*.jar'])
其中“依赖项”和“编译”都是方法

因此,您在build.gradle文件的某个地方包含了一个程序不支持的方法。例如,将依赖项设置为:

dependencies {
    nothing 'this.does.nothing.build:gradle:0.7.+'
}
这与写作是一样的:

dependencies.nothing 'this.does.nothing.build:gradle:0.7.+'
您将看到一个错误,上面写着“找到了不受支持的Gradle DSL方法:'nothing()'!” 显然,“无”不是真正的方法。我只是编出来的

所以你的一个“安卓”方法是错误的

dependencies.nothing 'this.does.nothing.build:gradle:0.7.+'