Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
36 lines (27 sloc) 906 Bytes

直接上代码:

项目根目录 新建 的文件 buildScriptConfig.gradle

ext {
    androidStudioGradlePluginVersion = '2.3.2'
    // ...
}

项目根目录 build.gradle 文件

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    apply from: "buildScriptConfig.gradle"

    repositories {
        jcenter()
    }

    dependencies {
        classpath "com.android.tools.build:gradle:$androidStudioGradlePluginVersion"

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

// ...

注意

apply 方法 必须 写在 buildscript 方法内部 (写在 dependencies 方法中也可以)...
当然, 不能写在 classpath "com.android.tools.build:gradle:$androidStudioGradlePluginVersion" 下面...