[英]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.我正在使用最新版本的 Android studio V4.1 在 Windows 10 上实现我的项目。该项目还需要 Java 11 和 Ndk 库。
First, I installed NDK V22 and V16 as well as Cmak from SDK tools in SKD manger as shown below:首先,我在 SKD 管理器中安装了 NDK V22 和 V16 以及来自 SDK 工具的 Cmak,如下所示:
Then, Installed Java 11 from Oracel.com, and checked using cmd as shown below:然后,从 Oracel.com 安装 Java 11,并使用 cmd 进行检查,如下所示:
I added the paths of SDK and NDK to the local.properties files as follows:我在local.properties文件中添加了SDK和NDK的路径如下:
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.另外,在系统环境中添加了 JAVA_HOME 和 ANDROID_NDK_HOME。
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.问题是我无法从 Android 项目中的“文件 > 项目结构 > Android NDK 位置”找到 NDK 路径来告诉 Android 工作室 NDK 位于何处。 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信息:Android Gradle 插件版本 4.1.1
Gradle Version 6.8 Gradle 版本 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这已移至 build.gradle 以保持构建的可重现性: https://developer.android.com/studio/releases/gradle-plugin#ndk-path
It's not in the UI because you should almost never use it.它不在 UI 中,因为您几乎不应该使用它。 You should be using
android.ndkVersion
in almost all cases.在几乎所有情况下,您都应该使用
android.ndkVersion
。 android.ndkPath
(and ndk.dir
) is just a way to make builds non-reproducible/non-portable. android.ndkPath
(和ndk.dir
)只是一种使构建不可复制/不可移植的方法。
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. android.ndkPath
有意义的情况是,如果您的 CI 服务仅将 NDK 安装到 SDK 不知道的特定位置,或者您使用的是未发布的 NDK。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.