如何修复 android studios 2.3 NDK 错误? [英] How to fix android studios 2.3 NDK bug?

查看:18
本文介绍了如何修复 android studios 2.3 NDK 错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我假设这是一个错误,因为在新更新之前我没有任何问题.所以我不能使用 gradle 控制台来调试我的应用程序,因为我有这个警告 -

I'm assuming it's a bug since I didn't have any problems until the new update. So I cant use the gradle console to debug my app because I have this warning -

按需配置是一项孵化功能.NDK 缺少平台"目录.如果您使用的是 NDK,请验证 ndk.dir 是否设置为有效的 NDK 目录.当前设置为 C:UsersEmily ThackerAppDataLocalAndroidSdk dk-bundle.如果您不使用 NDK,请从 ANDROID_NDK_HOME 或 local.properties 中取消设置 NDK 变量以删除此警告."

"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 C:UsersEmily ThackerAppDataLocalAndroidSdk dk-bundle. If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning."

我很确定我没有使用 NDK,我不知道如何解决这个问题,这是我的 local.properties

I am pretty sure I am not using NDK and I dont see how I can fix this problem here is my local.properties

## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file should *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=C:\Users\Emily Thacker\AppData\Local\Android\Sdk

另外,我在我的目录中没有看到 ANDROID_NDK_HOME 文件.

Also I do not see a ANDROID_NDK_HOME file in my directory.

推荐答案

我能够阻止这个烦人的消息;这对我有用.

I was able to prevent this annoying message; here is what worked for me.

背景:

  1. 我根本没有使用 NDK,也从未安装过 NDK.

  1. I am not using the NDK at all, and had never installed the NDK.

但是,正如 xsveda 在此处的另一个答案中所述,这是此处记录的 Gradle 错误:

However, as mentioned in another answer here by xsveda, this is a Gradle bug that is documented here:

https://code.google.com/p/android/问题/详细信息?id=228424

因此,即使是NDK 无辜者"也可能成为其受害者.

and so even the "NDK-innocent" may become its victims.

问题在于,即使您从未安装过 NDK,Gradle 也会通过将字符串/ndk-bundle"附加到 SDK 文件夹位置来计算 NDK 文件夹的位置.

The problem is that Gradle is computing the location of an NDK folder by just tacking on the string "/ndk-bundle" to the SDK folder location, even if you have never installed the NDK.

在建立对存在于特定位置的 NDK 文件夹的错误期望之后,每次构建时,Gradle 都会向您发出警告,指出您缺少"该文件夹.这只是一个警告,不会阻止您的构建完成,但这很烦人.

After establishing this false expectation of an NDK folder existing in a particular location, each time you build, Gradle gives you a warning that you're "missing" that folder. This is just a warning and does not prevent your build from completing, but it is annoying.

我如何阻止烦人的消息:

HOW I STOPPED THE ANNOYING MESSAGE:

由于磁盘空间便宜,而我的时间对我来说很宝贵,所以我通过安装 NDK 来解决这个错误,即使我不打算使用它.

Since disk space is cheap, and my time is precious to me, I humored this bug by installing the NDK, even though I do not intend to use it.

为此,您可以访问:

文件 -> 项目结构 -> SDK 位置

File -> Project Structure -> SDK Location

并查看 Android NDK 位置字段.如果您尚未安装 NDK,此字段将为空.

and look in the Android NDK location field. If you have not installed the NDK, this field will be empty.

在这种情况下,该字段下方将是安装 NDK 的链接.单击该链接并安装它.这需要几分钟.

In that case, below that field will be a link for installing the NDK. Click on that link and install it. It takes a few minutes.

安装完成并关闭安装进度对话框后,NDK 的位置将自动写入 Android NDK 位置字段.这将是这样的:

Once the installation completes and you close the installation progress dialog, the location of the NDK will be automatically written into the Android NDK location field. This will be something like:

C:devastudiosdk dk-bundle

C:devastudiosdk dk-bundle

单击确定"按钮并再次构建.错误消失.

Click the OK button and build again. The error disappears.

请注意,您可能可以在此字段中输入预期的文件夹;我没有尝试过.但我不知道这是否会导致其他一些问题,尤其是如果您最终决定实际使用 NDK.

Note that you may be able to just type the expected folder into this field; I did not try that. But I don't know whether that might cause some other problems, especially if you eventually decide to actually use the NDK.

这篇关于如何修复 android studios 2.3 NDK 错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆