【发布时间】:2021-03-27 17:15:50
【问题描述】:
我正在 Linux 服务器上使用 ./gradlew build 运行 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'
}
【问题讨论】:
-
就是这样。一旦我们调整了 agp 版本,gradle 就开始使用我们想要的 ndk 版本。谢谢。
标签: android gradle android-ndk