我正在尝试编辑简单的Andorid应用程序build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.51'
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
ext{
support_version = '27.1.1'
constraint_version = '1.1.2'
multidex_version = '1.0.3'
crashlytics_version = '2.9.4'
rxandroid_version = '2.0.2'
rxjava_version = '2.1.16'
rxkotlin_version = '2.2.0'
databinding_version = '3.1.3'
viewmodel_version = '1.1.1'
picasso_version = '2.71828'
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我应该添加https://developer.android.com/studio/build/application-id
我应该把andorid{...}放在哪里?
有两个分级,一个叫做build.gradle(Project:exampleProject)
,另一个叫做build.gradle(Module:App)
。将配置
放在第一个配置中。
应该与该示例类似:
android {
defaultConfig {
applicationId "com.example.myapp"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
...
}
ps:正如Gabriele Mariotti之前提到的,但这个答案是为了让新用户更清楚。欢呼:)