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

查看:83
本文介绍了如何修复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:\ Users \ Emily Thacker \ AppData \ Local \ Android \ Sdk \ ndk-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:\Users\Emily Thacker\AppData\Local\Android\Sdk\ndk-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/issues/detail?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:\ dev \ astudiosdk \ ndk-bundle

C:\dev\astudiosdk\ndk-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天全站免登陆