的Andr​​oid NDK构建,方法无法解析 [英] Android NDK build, Method could not be resolved

查看:171
本文介绍了的Andr​​oid NDK构建,方法无法解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有本土code的Andr​​oid项目。我可以通过调用 NDK建造命令没有错误或警告来构建从命令行本土code。但是,当我在ADT打开它会显示如下错误。

错误消息:方法CallStaticIntMethod无法解析有许多文件与项目类似的错误

我仔细检查配置,这里是我的。 Android的版本,工具链,包括正确配置(见下图)

要求包括也都在项目资源管理器中,它们是有效的(不是空的,并且指向正确的头文件)。

但是当我清除项目和构建它的错误仍然存​​在。关于如何解决这个任何想法?

配置:ADT 22.6.2,NDK r9d(64位),OSX 10.9.2

解决方案

在与preferences有些挣扎,我终于找到了解决办法。这是一个错误在NDK插件,它报道到AOSP但尚未固定的。答案的过去评论#50描述。这里是我们的工作为我的序列。

  1. 开启的项目属性的 - >的 C / C ++编译的 - >的工具陈主编
  2. 在第使用的工具替换 Android的GCC编译器 GCC C编译器。如果部分是空的,只需添加 GCC C编译器项在那里。
  3. 打开的项目属性的 - >的 C / C ++通用的 - >的路径和符号的添加目录,你的H-文件被包含的位置。使用的向上移动的按钮,添加一个文件夹与您当地的包括( / AudioPlayer / JNI 在我的情况),以第一的位置。然后加入平台和工具链,包括。内置包括应该留在最底层。 在我的情况的完整路径工具链包括就像下文。这些都是内置的原 Android的GCC编译工具链,这是我们替换在步骤2中的路径。

    <$p$p><$c$c>/Tools/android-ndk/toolchains/arm-linux-androideabi-4.6/$p$pbuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.6/include /Tools/android-ndk/toolchains/arm-linux-androideabi-4.6/$p$pbuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.6/include-fixed

  4. preSS的确定的按钮,洁净重新构建的项目。所有的错误必须离开。如果他们留下来,试图从删除的问题的观点,并重新构建项目一次。

更新:我已经找到另一个地方,在这里可以添加路径包含文件。不过这似乎是Eclipse版本依赖。 项目设置 - > C / C ++通用 - >处理器包含路径,宏等 - > CDT用户设置项 - >添加的。之后我加上面列出的路径,没有编译问题了。发展是有趣了。

I have an Android project with native code. I'm able to build native code from command line by calling ndk-build command with no errors or warnings. But when I open it in ADT it shows the following error.

Error message: Method CallStaticIntMethod could not be resolved. There are many files with similar errors in the project.

I double checked configuration and here is what I have. Android build, tool chain and includes are properly configured (see pictures below)

Required includes are also visible in the Project Explorer and they are valid (not empty and point to correct header files).

But when I Clean the project and Build it, the errors are still there. Any ideas on how to solve this?

Configuration: ADT 22.6.2, NDK r9d (64-bit), OSX 10.9.2

解决方案

After some struggling with preferences, I finally found a solution. This is a bug in NDK plugin which was reported to AOSP but not yet fixed. A past of the answer is described in comment #50. Here is the sequence which worked our for me.

  1. Open Project Properties -> C/C++ Build -> Tool Chan Editor
  2. In the section Used Tools replace Android GCC Compiler with GCC C Compiler. If section is empty, just add GCC C Compiler entry in there.
  3. Open Project Properties -> C/C++ General -> Paths and Symbols and add directories, where your h-files to be included are located. Use Move up button to add a folder with your local includes (/AudioPlayer/jni in my case) to the first place. Then add platform and toolchains includes. Built-in includes should stay at the very bottom. In my case the full paths to the toolchain includes were like below. These are built-in paths of original Android GCC Compiler toolchain, which we have replaced at step 2.

    /Tools/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.6/include
    /Tools/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.6/include-fixed
    

  4. Press OK button, clean and re-build the project. All errors must go away. If they stay, try to remove them from Problems view and re-build project once again.

Update: I have found another place, where you can add paths to include files. However it appears to be Eclipse version dependent. Project Settings -> C/C++ General -> Processor Include Paths, Macros etc. -> CDT User Settings Entries -> Add. After I added the paths listed above, there is no compilation issues anymore. Development is fun again.

这篇关于的Andr​​oid NDK构建,方法无法解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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