java - Can not set the path of NDK in project structure in Android studio
问题描述
I am using the latest version of Android studio V4.1 to implement my project on Windows 10. The project also requires Java 11 and Ndk libraries.
First, I installed NDK V22 and V16 as well as Cmak from SDK tools in SKD manger as shown below:
Then, Installed Java 11 from Oracel.com, and checked using cmd as shown below:
I added the paths of SDK and NDK to the local.properties files as follows:
sdk.dir=C\:\\Users\\user_name\\AppData\\Local\\Android\\Sdk
ndk.dir=C\:\\Users\\user_name\\AppData\\Local\\Android\\Sdk\\ndk\\22.0.7026061
Also, added JAVA_HOME and ANDROID_NDK_HOME in the system environment.
The problem is that I can not locate the NDK path from the "File > project structure> Android NDK location" in the Android project to tell the Android studio where is the NDK is located. It always shows as inactive and can not browse the path as shown in the below picture:
Info: Android Gradle Plugin Version 4.1.1
Gradle Version 6.8
Can anyone help to fix this problem?
解决方案
This was moved to the build.gradle to keep builds reproducible: https://developer.android.com/studio/releases/gradle-plugin#ndk-path
It's not in the UI because you should almost never use it. You should be using android.ndkVersion
in almost all cases. android.ndkPath
(and ndk.dir
) is just a way to make builds non-reproducible/non-portable.
The cases where android.ndkPath
makes sense are if your CI service only has the NDK installed to a specific location not known to the SDK, or if you're using an unreleased NDK.
推荐阅读
- sql - Oracle SQL 查询修复主键中的空问题
- reactjs - 如何使用 hookrouter 制作自定义链接组件?
- java - 我需要退出一个方法,而不返回一个值
- python - 自适应灰度膨胀实现
- jquery - 使用 AJAX 更新部分页面后,DataTables jquery 插件消失
- css - UI Bootstrap/Bootstrap 3 - 如何使容器居中?
- python - 调用函数时不会创建 Python Tkinter Tic-Tac-Toe 窗口
- flutter - 如何在单击按钮时刷新 ListViewBuilder?
- pandas - pandas 中多个数据帧部分共享索引的操作
- java - 如何为不是 Spring Boot 的 Java 应用程序指定外部配置文件