简体   繁体   English

无法在 Android Studio 上设置 Android NDK 版本

[英]Can't set Android NDK version on Android Studio

When I try setting ndk version on android studio, via project structure -> sdk location, the search box is grayed out.当我尝试在 android studio 上设置 ndk 版本时,通过项目结构 -> sdk 位置,搜索框显示为灰色。 So I went to the local.properties file, and set ndk.dir there.所以我去了 local.properties 文件,并在那里设置了 ndk.dir。 But the issue is that when I do this, android studio can't sync gradle, and it constantly throws me this "SILLY ERROR"但问题是,当我这样做时,android studio 无法同步 gradle,它不断地向我抛出这个“愚蠢的错误”

Gradle sync failed: exception during working with external system: Gradle 同步失败:使用外部系统时出现异常:

I tried setting system environment variable for the ndk directory, but it still didn't function !!!!!!!我尝试为ndk目录设置系统环境变量,但它仍然没有 function !!!!!!!

This IDE is frustrating.这个 IDE 令人沮丧。 where should I set my NDK version then?那我应该在哪里设置我的NDK版本呢? I stuck and every solution I try online doesn't work.我卡住了,我在网上尝试的每个解决方案都不起作用。

The recent version of Android Gradle Plugin expect you to install NDK (side by side) via the SDK Manager, and choose the version for your module in build.gradle : Android Gradle 插件的最新版本希望您通过 SDK 管理器安装 NDK (并行) ,并在build.gradle中为您的模块选择版本:

android {
    …
    android.ndkVersion '19.2.5345600'
}

The reason that your SDK location is grayed out might be because you don't have one installed.您的 SDK 位置显示为灰色的原因可能是因为您没有安装。

I found this question asked earlier that can help you solve this problem:我发现之前问的这个问题可以帮助你解决这个问题:

Android Studio SDK Managed Disabled Android 工作室 SDK 托管 禁用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM