Eclipse 错误:ndk 的路径无效?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9936637/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 17:55:59  来源:igfitidea点击:

Eclipse error: invalid path for ndk?

androideclipseandroid-ndk

提问by Azhar

I want to integrate some c code with Android so as first step I has to specify NDK path in Native Developmentnode. But when I specify NDK path it gives error Invalid path for NDKI googled but could not find some solution. Am I missing some step.

我想将一些 c 代码与 Android 集成,因此第一步我必须在本机开发节点中指定 NDK 路径。但是当我指定 NDK 路径时,它会给出错误NDK 的无效路径,我用谷歌搜索但找不到一些解决方案。我是不是错过了一些步骤。

SDKand NDKare in the same folder and SDK path working fine.

SDKNDK在同一个文件夹中,并且 SDK 路径工作正常。

Please help

请帮忙

I have installed

我已经安装

  • make-3.81
  • nawk-2007.10.23-setup
  • Cygwin
  • ADT-17.0.0
  • Sequoyah
  • android-ndk-r7b-windows.zip (Extracted) enter image description here
  • make-3.81
  • nawk-2007.10.23-setup
  • 赛格温
  • ADT-17.0.0
  • 红杉
  • android-ndk-r7b-windows.zip(解压) 在此处输入图片说明

EDIt:

编辑:

I just check the link and came to know that it could be GCC absent problem .How do I check that if its GCC problem or not , or How can I check if GCC is installed or not?

我只是检查了链接,才知道可能是 GCC 缺失问题。如何检查 GCC 是否有问题,或者如何检查 GCC 是否已安装?

采纳答案by Oscar Salguero

Mmm... weird error. Keep in mind that in order to use the NDK, the SDK should be working in perfect way before you start with the NDK, said that, I suggest you to try the following:

嗯……奇怪的错误。请记住,为了使用 NDK,SDK 应该在您开始使用 NDK 之前以完美的方式工作,也就是说,我建议您尝试以下操作:

1- Be sure you have the pre-requisites:

1- 确保您具备先决条件:

  • For all development platforms, GNU Make 3.81 or later is required. Earlier versions of GNU Make might work but have not been tested.
  • A recent version of awk (either GNU Awk or Nawk) is also required.
  • For Windows, Cygwin 1.7 or higher is required. The NDK will not work with Cygwin 1.5 installations.
  • 对于所有开发平台,都需要 GNU Make 3.81 或更高版本。早期版本的 GNU Make 可能有效,但尚未经过测试。
  • 还需要最新版本的 awk(GNU Awk 或 Nawk)。
  • 对于 Windows,需要 Cygwin 1.7 或更高版本。NDK 不适用于 Cygwin 1.5 安装。

2- Start from scratch again by deleting any NDK references such as the settings on eclipse, paths, folders, zips, etc.

2- 通过删除任何 NDK 引用(例如 eclipse、路径、文件夹、zip 等的设置)重新从头开始。

3- Be sure you have updated to the latest Android SDK and ADT Tools. Using the Help->Check for Updates Menu in ECLIPSE and then be sure you have all the things are up to date on the Android SDK Manager.

3- 确保您已更新到最新的 Android SDK 和 ADT 工具。使用 ECLIPSE 中的“帮助”->“检查更新”菜单,然后确保您在 Android SDK 管理器上的所有内容都是最新的。

4- I see a "D:/" on your question, so you're using a Windows PC... it must be a Windows XP (32-bit) or Vista (32- or 64-bit). Be sure to get the Windows version (http://dl.google.com/android/ndk/android-ndk-r7b-windows.zip), and when you have unzipped that ndk, rename the folder to "ndk". You can put it next to where your SDK's folder is, it should not matter.

4- 我在您的问题中看到“D:/”,所以您使用的是 Windows PC……它必须是 Windows XP(32 位)或 Vista(32 位或 64 位)。请务必获取 Windows 版本 (http://dl.google.com/android/ndk/android-ndk-r7b-windows.zip),并在解压缩该 ndk 后,将文件夹重命名为“ndk”。你可以把它放在你的 SDK 文件夹旁边,这应该没有关系。

5- Open Eclipse, and give it the path to the NDK, and see what happens.

5- 打开 Eclipse,并给它 NDK 的路径,看看会发生什么。

Good luck!

祝你好运!

回答by Jamil Ahmad

I exhuasted to solve this problem "Invalid path for android SDK" but it got solved at last. Here is how it got solved. My system specs: P4 3.2 GHz, Windows 7 32-bit, Eclipse Standard Edition 4.3 (Kepler). Other supporting softwares: MinGW with GNU make 3.81.

我很想解决这个问题“Android SDK 的路径无效”,但它终于解决了。这是它解决的方法。我的系统规格:P4 3.2 GHz,Windows 7 32 位,Eclipse 标准版 4.3 (Kepler)。其他配套软件:MinGW with GNU make 3.81。

Problem (first the problem I faced and then the solution): I downloaded Android NDK latest version from "developer.android.com/sdk/ndk/index.html" which was "android-ndk-r9-windows-x86.zip". Then I extracted it in C:\ directory then I added a ";C:\android-ndk-r9" in my PATH variable. Then I installed "Sequoyah Android Native Code Support" using eclipse "install new software" option (Help ? Install New Software?type "Indigo - http://download.eclipse.org/releases/indigo" in the work withfield ? go to Mobile and Device Developmentcategory and select Sequoyah Android Native Code Support). Then I went to eclipse menu "Window ? Preferences ? Android ? Native Development" and entered "C:\android-ndk-r9" in the NDK location and got error " Invalid path for NDK".

问题(首先是我遇到的问题,然后是解决方案):我从“developer.android.com/sdk/ndk/index.html”下载了 Android NDK 最新版本,即“android-ndk-r9-windows-x86.zip” . 然后我将它解压缩到 C:\ 目录中,然后在我的 PATH 变量中添加了一个“;C:\android-ndk-r9”。然后我使用eclipse“安装新软件”选项安装了“Sequoyah Android Native Code Support”(帮助?安装新软件?在工作字段中输入“Indigo - http://download.eclipse.org/releases/indigo” ?去到移动和设备开发类别并选择 Sequoyah Android 本机代码支持)。然后我去eclipse菜单“窗口?首选项?Android?本机开发”并输入“C:

Solution: I search exhaustively on internet and tried different solution but the solution worked for me was:

解决方案:我在互联网上进行了详尽的搜索并尝试了不同的解决方案,但对我有用的解决方案是:

I downloaded the older version of NDK ( download link: "dl.google.com/android/ndk/android-ndk-r7c-windows.zip" ) and extracted in C:\ directory using winrar and updated the PATH in environment variable to point to the new NDK version 7c. When now I entered the path it accepted. No error appeared. the problem is Sequoyah doesn't accept new version because it has not updated since 2011 ( I'm not sure) Note1: for Linux users download link: "dl.google.com/android/ndk/android-ndk-r7b-darwin-x86.tar.bz2" Note2: you can change the version in the link according to your requirement for example "dl.google.com/android/ndk/android-ndk-r4bc-windows.zip" to download version 4b. Thanks.

我下载了旧版本的 NDK(下载链接:“dl.google.com/android/ndk/android-ndk-r7c-windows.zip”)并使用 winrar 在 C:\ 目录中解压缩并将环境变量中的 PATH 更新为指向新的 NDK 版本 7c。当我进入它接受的路径时。没有出现错误。问题是 Sequoyah 不接受新版本,因为它自 2011 年以来没有更新(我不确定)注 1:Linux 用户下载链接:“dl.google.com/android/ndk/android-ndk-r7b-darwin -x86.tar.bz2" 注2:您可以根据您的要求更改链接中的版本,例如“dl.google.com/android/ndk/android-ndk-r4bc-windows.zip”下载版本4b。谢谢。

回答by waxspin

Check your path to the NDK-- this has, on more than one occasion been the issue for me, at least with the SDK. (Not NDK in my instance) I know that, for instance, at the moment my NDK path is ~/android-ndk-r6/android-ndk-r6/

Also, to install gcc in windows, you must install Cygwinor such compatible gcc setup for windows. (The docs heresay that it is required, but I think I may have heard of people using some slightly different implementation.) Cygwin works well for me, but you may need to specify gcc, make, and so on, in the installer as packages to be downloaded and set up on your machine, so read your installation options carefully. If you find that you have more packages that need to be installed, you can run the setup.exe program again and install them in-place.

In addition, here(at the bottom of the page) you can find an installation guide for the NDK in case you run into further issues.

检查你的 NDK 路径——这对我来说不止一次是个问题,至少对于 SDK。(在我的例子中不是 NDK)我知道,例如,目前我的 NDK 路径是 ~/android-ndk-r6/android-ndk-r6/

另外,要在 windows 中安装 gcc,你必须安装Cygwin或类似的兼容Windows 的 gcc 设置。(这里的文档说它是必需的,但我想我可能听说有人使用了一些稍微不同的实现。)Cygwin 对我来说效果很好,但是您可能需要在安装程序中指定 gcc、make 等作为要下载的包并在您的机器上进行设置,因此请仔细阅读您的安装选项。如果您发现有更多的软件包需要安装,您可以再次运行 setup.exe 程序并就地安装它们。

此外,在这里(在页面底部)您可以找到 NDK 的安装指南,以防您遇到更多问题。

回答by Saqib Razaq

Try to create a new systems variable called "NDK" and set its value to the NDK path.

尝试创建一个名为“NDK”的新系统变量并将其值设置为 NDK 路径。

回答by Suvam Roy

Hope some file is missing in your ndk folder, so that it is unable to identify the ndk folder. Download ndk again and load it, otherwise update the native development plugin...

希望您的 ndk 文件夹中缺少某些文件,因此无法识别 ndk 文件夹。重新下载ndk并加载,否则更新原生开发插件...

回答by vgonisanz

You said SDK and NDK are in same folder. It could be a conflict with the route. Try this:

你说 SDK 和 NDK 在同一个文件夹中。可能是路径冲突。尝试这个:

  • Uninstall NDK
  • Reinstall NDK at D:\ecpspace\NDK\android-ndk-r7b
  • Create new PATH on enviroment var
  • Restart computer
  • 卸载 NDK
  • 在 D:\ecpspace\NDK\android-ndk-r7b 重新安装 NDK
  • 在环境变量上创建新的 PATH
  • 重启电脑

On linux work for me, i had 2 ndks installed in different routes, and when i used eclipse, was compiling using the other one, and don't worked as i wanted.

在对我来说有效的 linux 上,我在不同的路径中安装了 2 个 ndks,当我使用 eclipse 时,正在使用另一个进行编译,并且没有按我想要的方式工作。

回答by Sir Oslay

This might sound dumb, but did you download the correct package? I had the same problem on linux until I realized I was trying to use the Windows version (I had downloaded it earlier while I was trying to install it on a different computer with cygwin). I downloaded the linux package and everything worked.

这听起来可能很愚蠢,但是您下载了正确的软件包吗?我在 linux 上遇到了同样的问题,直到我意识到我正在尝试使用 Windows 版本(我早些时候在尝试使用 cygwin 在另一台计算机上安装它时下载了它)。我下载了 linux 包,一切正常。

回答by Andrew Prock

I've only been at this for a couple of days, but in my brief experience, the NDK and eclipse do not play well together. I would suggest moving to the command line for the NDK portion of the project for the time being. Some good tutorials can be found at:

我只讨论了几天,但根据我的简短经验,NDK 和 eclipse 不能很好地协同工作。我建议暂时转到项目 NDK 部分的命令行。可以在以下位置找到一些不错的教程:

http://www.cmumobileapps.com/2011/08/31/compiling-open-source-libraries-with-android-ndk-part-1/

http://www.cmumobileapps.com/2011/08/31/compiling-open-source-libraries-with-android-ndk-part-1/

http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-development/

http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-development/

回答by Andrew

I have similar bug (Eclipse Version: Indigo Service Release 2, Build id: 20120216-1857). The main problem was in Sequoyaplug-in. Problem disappear when I update Sequoya to the latest version.

我有类似的错误(Eclipse 版本:Indigo Service Release 2,构建 ID:20120216-1857)。主要问题在于红杉插件。当我将 Sequoya 更新到最新版本时,问题就消失了。