buildScript在gradle构建部分或构建的根级别中声明存储库之间有什么区别.
选项1:
build.gradle:
buildScript {
repositories {
mavenCentral();
}
}
Run Code Online (Sandbox Code Playgroud)
要么
build.gradle:
repositories {
mavenCentral();
}
Run Code Online (Sandbox Code Playgroud) 从我的国家访问maven官方存储库的速度很慢,所以我想首先尝试一些本地存储库.
是否能够将它们添加到某个全局gradle配置文件中,我可以在每个gradle项目中使用它们,而无需修改项目范围build.gradle文件?
项目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:3.0.0-alpha3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)
App Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.arun4fms.efix"
minSdkVersion 17
targetSdkVersion 25 …Run Code Online (Sandbox Code Playgroud) java android android-studio build.gradle android-gradle-plugin