以下代码来自https://github.com/android/camera/blob/master/CameraXBasic/build.gradle
ext.kotlin_version = '+'Build.gradle 是什么意思?
构建.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
}
}
Run Code Online (Sandbox Code Playgroud)
普通代码
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
}
}
Run Code Online (Sandbox Code Playgroud)
很多时候我们看到“+”是这样的:
compile 'com.android.support:appcompat-v7:23.0.+'
Run Code Online (Sandbox Code Playgroud)
这意味着版本 23.0.0 或更高版本,只要它以 23.0 开头。
在您的情况下,这意味着最新版本,可能是 1.0.0、2.1.0、0.0.1、25.10.100 或任何最新版本。但我想指出,这是不好的做法,因为这可能会产生非确定性的构建,这意味着一次源代码可以成功构建,而另一次它可能会失败而无需修改其中的任何内容。有关更多信息,请查看此链接:https : //blog.danlew.net/2015/09/09/dont-use-dynamic-versions-for-your-dependencies/
| 归档时间: |
|
| 查看次数: |
4484 次 |
| 最近记录: |