android - Android:Gradle build 不断拉下最新的 NDK 版本,而不是使用已经安装的版本
问题描述
我正在./gradlew build
Linux 服务器上运行 gradle 构建,并且 gradle 不断尝试安装最新版本的 NDK (22)
Welcome to Gradle 5.1.1!
Here are the highlights of this release:
- Control which dependencies can be retrieved from which repositories
- Production-ready configuration avoidance APIs
For more details see https://docs.gradle.org/5.1.1/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
> Configure project :ui_manager_library
Checking the license for package NDK in /usr/local/android-sdk/licenses
License for package NDK accepted.
Preparing "Install NDK (revision: 22.0.7026061)".
"Install NDK (revision: 22.0.7026061)" ready.
Installing NDK in /usr/local/android-sdk/ndk-bundle
"Install NDK (revision: 22.0.7026061)" complete.
"Install NDK (revision: 22.0.7026061)" finished.
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /usr/local/android-sdk/ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
FAILURE: Build failed with an exception.
服务器已经安装了 NDK 并设置了路径。我们需要使用20.0.5594570 *
ANDROID_NDK_HOME='/usr/local/android-sdk/ndk/20.0.5594570'
我怎样才能让 Gradle 看到这个?我的 app/build.gradle 也有版本集
android {
ndkVersion '20.0.5594570'
}
解决方案
正如 WS Ayan 所指出的,将 Android Gradle 插件更新到适当的版本允许我们强制执行 NDK 版本。
推荐阅读
- mysql - Erlang 无法连接到 mysql/mariadb
- python - 从整个列的 DF 中获取索引值的索引值的 DataFrame
- django - 使用 ReactJS 作为前端时,我们需要渲染模板吗?
- python - 如何获取先前的行值并用作输入来计算 Pandas 中的当前行值?
- python - 在算法运行之前,我将如何创建一个函数来测试我的树?
- oracle - 连接到 Teamcity 到 OCI 自治事务处理数据库
- django - Django Celery:任务永远不会执行
- python - 为什么元组或列表中的最后一个值索引在python中给出不同的类而切片给出不同的?
- java - Spring Tomcat错误常量池中的无效字节标记:19
- stm32f4 - STM32F4 SRAM 内容即使在电源复位和待机后仍保留