在Eclipse开放的Hello-jni.c文件只在编译HELLO-JNI故障日食 [英] Compiling Hello-Jni failure in eclipse only when opening the hello-jni.c file in eclipse

查看:374
本文介绍了在Eclipse开放的Hello-jni.c文件只在编译HELLO-JNI故障日食的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图不断地打造为Android NDK样本HelloJni示例项目。

如何设置环境:

我跟着的指令得到的文档开始:Android的NDK-r10d \文档\ Getting_Started / HTML / index.html的:

  1. 下载的是Eclipse的红月
  2. 下载了Android SDK
  3. 下载了Android NDK:的Andr​​oid NDK-r10d
  4. 设置NDK的安装文件夹在eclipse在preferences窗口 - >机器人 - > NDK
  5. 进口HELLP-JNI样品。
  6. 右键点击HelloJni项目 - > Android的工具 - >添加原生支持
  7. 清理在建和建成项目。
  8. 然我的设备上的HelloJni库(未测试)

和应用程序正在运行,一切正常,我可以看到生成的每个建筑.so文件在项目的libs文件夹(为每个架构,例如armebi,MIPS,等...)

下面是打印屏幕显示的一切工作:

现在,这里是陌生的一部分......

的问题:

如果我打开HELLO-jni.c文件进行编辑或查看日食,我突然看到编译错误,我不能建立,不能运行该项目了...

下面是打印屏幕显示后,我打开文件的时候,突然出现编译错误:

我已经尝试过什么,但失败了:

  1. 添加了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。是Cygwin的路径上]产生java.io.IOException:不能运行程序cygpath。所以,我用Google搜索,我改变了构建设置给我的NDK安装文件夹的绝对路径:
  • 根据这个计算器的链接: 无法启动cygpath在安卓

    下面是一个打印屏幕:

    失败

    <醇开始=3>
  • 更改从Android的GCC编译的使用工具GCC C编译器
  • 根据这个计算器的链接: <一href="http://stackoverflow.com/questions/23155676/android-ndk-build-method-could-not-be-resolved/23158929#23158929">Android NDK构建,方法无法得到解决

    下面是一个打印屏幕:

    失败

    <醇开始=4>
  • 复制从朋友处得知了这个项目为他工作的日食月亮安装。
  • 失败

    我已经花时间在这,我找不到任何解决方案,为什么会这样。

    请帮助

    解决方案

    FWIW,Eclipse的似乎与在 r10d 版本的Andr​​oid 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:

    1. Downloaded Eclipse Luna
    2. Downloaded the Android SDK
    3. Downloaded the Android NDK: android-ndk-r10d
    4. Set the NDK installation folder in eclipse in preferences window -> android -> NDK.
    5. Imported the hellp-jni sample.
    6. Right click on the HelloJni Project -> Android tools -> Add native support.
    7. Cleaned and Built the project.
    8. 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:

    1. 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

    1. 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

    1. 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

    1. 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屋!

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