在Eclipse开放的Hello-jni.c文件只在编译HELLO-JNI故障日食 [英] Compiling Hello-Jni failure in eclipse only when opening the hello-jni.c file in eclipse
问题描述
我一直在试图不断地打造为Android NDK样本HelloJni示例项目。
如何设置环境:
我跟着的指令得到的文档开始:Android的NDK-r10d \文档\ Getting_Started / HTML / index.html的:
- 下载的是Eclipse的红月
- 下载了Android SDK
- 下载了Android NDK:的Android NDK-r10d
- 设置NDK的安装文件夹在eclipse在preferences窗口 - >机器人 - > NDK
- 进口HELLP-JNI样品。
- 右键点击HelloJni项目 - > Android的工具 - >添加原生支持 。
- 清理在建和建成项目。
- 然我的设备上的HelloJni库(未测试)
和应用程序正在运行,一切正常,我可以看到生成的每个建筑.so文件在项目的libs文件夹(为每个架构,例如armebi,MIPS,等...)
下面是打印屏幕显示的一切工作:
现在,这里是陌生的一部分......
的问题:
如果我打开HELLO-jni.c文件进行编辑或查看日食,我突然看到编译错误,我不能建立,不能运行该项目了...
下面是打印屏幕显示后,我打开文件的时候,突然出现编译错误:
我已经尝试过什么,但失败了:
- 添加了Android原生自然,然后将其取出: 删除项目文件, 的buildCommand标签:org.eclipse.cdt.managedbuilder.core.genmakebuilde, org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder:的buildCommand标签 和除去行: [自然] org.eclipse.cdt.core.cnature [/本性] [自然] org.eclipse.cdt.core.ccnature [/本性] [自然] org.eclipse.cdt.managedbuilder.core.managedBuildNature [/本性] [自然] org.eclipse.cdt.managedbuilder.core.ScannerConfigNature [/性质] 除去.cproject和所有编译后的文件。 然后加回了Android原生自然。
根据这个计算器的链接: <一href="http://stackoverflow.com/questions/23122934/eclipse-adt-unresolved-inclusion-jni-h/23729649#23729649">Eclipse ADT - 未解决的包容jni.h
失败
<醇开始=2>根据这个计算器的链接: 无法启动cygpath在安卓
下面是一个打印屏幕:
失败
<醇开始=3>根据这个计算器的链接: <一href="http://stackoverflow.com/questions/23155676/android-ndk-build-method-could-not-be-resolved/23158929#23158929">Android NDK构建,方法无法得到解决
下面是一个打印屏幕:
失败
<醇开始=4>失败
我已经花时间在这,我找不到任何解决方案,为什么会这样。
请帮助
FWIW,Eclipse的似乎与在 r10d 版本的Android NDK的问题。请参见的https://$c$c.google.com/ P /安卓/问题/详细信息?ID = 97023 。我建议你尝试 R10C 而不是#worksforme:)
I have been trying endlessly to build the sample HelloJni sample project for the Android NDK.
How I set up the environment:
I followed the instructions of the getting started in the docs: android-ndk-r10d\docs\Getting_Started/html/index.html:
- Downloaded Eclipse Luna
- Downloaded the Android SDK
- Downloaded the Android NDK: android-ndk-r10d
- Set the NDK installation folder in eclipse in preferences window -> android -> NDK.
- Imported the hellp-jni sample.
- Right click on the HelloJni Project -> Android tools -> Add native support.
- Cleaned and Built the project.
- Ran on my device the HelloJni library (not the tests)
And the app is running and everything is WORKING and I can see the generated .so file per architecture in the libs folder of the project (for every architecture, for example armebi, mips, etc...)
Here is a Print Screen showing everything is working:
Now here comes the strange part...
The Problem:
If I open the hello-jni.c file for editing or viewing in eclipse, I suddenly see compilation errors and I can't build and can't run the project anymore...
Here is a Print Screen showing that after i open the file, I suddenly get compilation errors:
What I have already tried but failed:
- Adding the Android Native Nature, then removing it by: Deleting the .project file, the buildCommand tag of: org.eclipse.cdt.managedbuilder.core.genmakebuilde, the buildCommand tag of: org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder and removing the lines: [nature]org.eclipse.cdt.core.cnature[/nature] [nature]org.eclipse.cdt.core.ccnature[/nature] [nature]org.eclipse.cdt.managedbuilder.core.managedBuildNature[/nature] [nature]org.eclipse.cdt.managedbuilder.core.ScannerConfigNature[/nature] removing the .cproject and all compiled files. Then adding back the Android Native Nature.
According to this stackoverflow link: Eclipse ADT - Unresolved inclusion jni.h
Failed
- Once I got the error of (I am not getting it anymore): Unable to launch cygpath. Is Cygwin on the path?] java.io.IOException: Cannot run program "cygpath". So I Googled and I changed the build settings to give the absolute path of my NDK installation folder:
According to this stackoverflow link: Unable to launch cygpath in android
Here is a Print Screen:
Failed
- Changing the Used tools from Android GCC Compiler to GCC C Compiler
according to this stackoverflow link: Android NDK build, Method could not be resolved
Here is a Print Screen:
Failed
- Copying an eclipse Luna installation from a friend that has the project working for him.
Failed
I have been spending hours on this and I couldn't find any solution to why this is happening.
PLEASE HELP
FWIW, Eclipse seems to have issues with the r10d version of Android NDK. See https://code.google.com/p/android/issues/detail?id=97023. I suggest you try r10c instead #worksforme :)
这篇关于在Eclipse开放的Hello-jni.c文件只在编译HELLO-JNI故障日食的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!