在采用Gradle构建Android项目时候出现如下错误信息:
Executing tasks: [:app:assembleRelease]
Configuration on demand is an incubating feature.
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 /home/android-linux-sdk/ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
Incremental java compilation is an incubating feature.
:app:buildInfoDebugLoader
:app:buildNative FAILED
:app:buildInfoGeneratorDebug
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:buildNative'.
> A problem occurred starting process 'command '/home/android-linux-sdk/ndk-bundle/ndk-build''
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 6.369 secs
解决方法:
该错误信息说明在“/home/android-linux-sdk/ndk-bundle/”文件夹下找不到“ndk-build”文件,因为Android Studio未自带NDK开发工具,因此会出现此错误。
该错误信息说明在“/home/android-linux-sdk/ndk-bundle/”文件夹下找不到“ndk-build”文件,因为Android Studio未自带NDK开发工具,因此会出现此错误。
到“https://developer.android.google.cn/ndk/downloads/index.html”下载Linux 64 位 (x86)版本,我下载的时候,版本号为:android-ndk-r16b-linux-x86_64,下载完毕后将其解压,得到一个“android-ndk-r16b”文件夹,将其内部的所有文件全部移动至“/home/davidhopper/Android/Sdk/ndk-bundle/”文件夹下,重启Android Studio,问题解决。
如有更好的方案请分享一下。