使用Gradle构建Android Studio项目

使用Gradle构建Android Studio项目,android,gradle,android-studio,Android,Gradle,Android Studio,我试图通过在Studio中导入Android Studio应用程序来构建Android Studio应用程序,但我有一个问题 我的Android Studio版本Beta 0.8.14 在我的gradle-wrapper.properties文件distributionUrl中: distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip 我需要在我的build.gradle文件的app文件夹下添加以

我试图通过在Studio中导入Android Studio应用程序来构建Android Studio应用程序,但我有一个问题

我的Android Studio版本Beta 0.8.14

在我的gradle-wrapper.properties文件distributionUrl中: distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip

我需要在我的build.gradle文件的app文件夹下添加以下更改 来构建此应用程序

修改文件:

原始文件:

如果我没有添加buildscript更改,则会出现错误:找不到id为“com.android.application”的1,0插件 为什么我需要添加buildscript部分,以使其可编译

更新

是的,我有顶级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:0.12.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

您是否有project build.gradle文件,如果有,它包含什么?是的,我有build.gradle文件,请查看我的更新问题。您遇到了哪些错误?错误:未找到id为“com.android.application”的1,0插件
apply plugin: 'com.android.application'

----- Other things -----
// 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:0.12.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}