The following code is from https://github.com/android/camera/blob/master/CameraXBasic/build.gradle
What does ext.kotlin_version = '+'
mean in Build.gradle?
Build.gradle
buildscript {
// Top-level variables used for versioning
ext.kotlin_version = '+'
ext.java_version = JavaVersion.VERSION_1_8
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.0.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Normal Code
buildscript {
ext.kotlin_version = '1.3.41'
ext.anko_version = '0.10.8'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
The " allprojects " section is for the modules being built by Gradle. Oftentimes the repository section is the same for both, since both will get their dependencies from jcenter usually (or maybe maven central).
KTS: Refers to Kotlin script, a flavor of the Kotlin language used by Gradle in build configuration files. Kotlin script is Kotlin code that can be run from the command line. Kotlin DSL: Refers primarily to the Android Gradle plugin Kotlin DSL or, occasionally, to the underlying Gradle Kotlin DSL.
Android Studio uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations. Each build configuration can define its own set of code and resources, while reusing the parts common to all versions of your app.
The Application level build. gradle file is located in each module of the android project. This file includes your package name as applicationID , version name(apk version), version code, minimum and target sdk for a specific application module.
Often times we see '+' as such:
compile 'com.android.support:appcompat-v7:23.0.+'
Which means version 23.0.0 or higher as long as it starts with 23.0.
In your case it means the latest version, could be 1.0.0, 2.1.0, 0.0.1, 25.10.100 or anything that is latest. But I would like to note out that this is bad practice as this could produce non-deterministic builds, meaning one time the source code could build successfully and another time it might fail without ever modifying anything in it. For more info check this link: https://blog.danlew.net/2015/09/09/dont-use-dynamic-versions-for-your-dependencies/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With