采用Android NDK当Eclipse错误 [英] Eclipse errors when using Android NDK

查看:136
本文介绍了采用Android NDK当Eclipse错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图创建为Android一个新的本地项目,但运行到奇怪的问题。我创建了一个新的项目,并选择了Android的工具>添加本机支持,它的创建再经过时,我preSS运行Eclipse抱怨一些问题,包括jni.h.我检查了C / C ++路径和符号是由ADT正确设置它精细出现:

但是我得到了在Eclipse我CPP code编译器错误。但是,什么是奇怪的是,当我通过它工作正常终端项目运行NDK的构建,见下图:

此外,这里的code(jnitest.cpp):

 的#include< jni.h>JNIEXPORT的jstring JNICALL Java_com_brianrojas_jnitest_MainActivity_echo
    (JNIEnv的* ENV,jobject对象的jstring输入)
{
    返回输入;
}

因此​​,它看起来像库可以建立OK但是Eclipse只是不喜欢它由于某种原因而不可能在我的手机上安装的应用程序。任何想法我上来了?也低于是我的Andr​​oid Eclipse插件的信息柜面帮助。


解决方案

我知道什么可能是错误的:的Eclipse朱诺

只要下载Eclipse的靛蓝,它应该工作。这是一个已知的bug。显然,它也有可能发生,如果你使用的是Windows开发:


  

已知问题


  
  

      
  1. Eclipse不自动查找包括路径的所有Windows上的NDK头。这个问题将在下次更新
      (20.0.1),当它被释放。

  2.   
  3. Eclipse不自动查找包括CDT 8.1.0(麦浚龙)的路径。这个问题在追踪错误33788。

  4.   

<一个href=\"http://tools.android.com/recent/usingthendkplugin\">http://tools.android.com/recent/usingthendkplugin

trying to create a new native project for android but running into weird issue. I created a new project and selected 'Android Tools > Add Native Support', then after it's created when I press Run eclipse complains about some problems including jni.h. I checked that the C/C++ Paths and Symbols were set correctly by the ADT and it appears fine:

However I get compiler errors in my cpp code from Eclipse. But what's weird is when I run ndk-build on the project through the terminal it works fine, see below:

Also here's the code (jnitest.cpp):

#include <jni.h>

JNIEXPORT jstring JNICALL Java_com_brianrojas_jnitest_MainActivity_echo
    (JNIEnv *env, jobject object, jstring input)
{
    return input;
}

So it looks like the libraries can build OK but Eclipse just doesn't like it for some reason and won't install the app on my phone. Any ideas what I'm doin wrong? Also below is my android eclipse plugin info incase that helps.

解决方案

I know what might be wrong: Eclipse Juno.

Just download Eclipse Indigo and it should work. This is a known bug. Apparently it can also happen if you're developing on windows:

Known Issues

  1. Eclipse does not automatically find the include paths to all the NDK headers on Windows. This issue will be fixed in the next update (20.0.1) when it is released.
  2. Eclipse does not automatically find the include paths with CDT 8.1.0 (Juno). This issue is tracked in Bug 33788.

http://tools.android.com/recent/usingthendkplugin

这篇关于采用Android NDK当Eclipse错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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