根据Android SDK Release Notes您不再需要在项目的 build.gradle 中定义 buildToolsVersion 属性,因为使用了默认版本
If you're using Android plugin for Gradle 3.0.0 or higher, your project automatically uses a default version of the build tools that the plugin specifies.
但是,我正在尝试配置我们的持续集成服务器以对已编译的应用程序进行签名,但我无法弄清楚要使用哪个版本的构建工具。
如果 build.gradle 定义了一个 buildToolsVersion 那么它可以被提取,但是如果没有定义,我如何实用地找到“默认”版本?
所有文档都说使用 "default"或 "recommended"版本,但从未定义如何找到它
最佳答案
既不计算也不定义buildToolsVersion
的默认/推荐值,因此它默认为最新的构建工具,始终匹配目标 API 级别,这由 targetSdkVersion 定义。 . Release Notes SDK 构建工具阅读:
SDK Build Tools release notes Android SDK Build-Tools is a component of the Android SDK required for building Android apps. It's installed in the /build-tools/ directory.
You should always keep your Build Tools component updated by downloading the latest version using the Android SDK Manager. If you're using Android plugin for Gradle 3.0.0 or higher, your project automatically uses a default version of the build tools that the plugin specifies.
最有趣的是:
To use a different version of the build tools, specify it using buildToolsVersion in your module's build.gradle, as follows ...
这意味着,可以简单地从模块的 build.gradle
中删除 buildToolsVersion
属性。以前在更新目标 API 时总是必须更改两个值 - 在更新 build-tools 时更频繁。还有新requirements适用于 Play 商店。
关于android - 计算默认的 buildToolsVersion,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51661641/