Android NDK build, Method could not be resolved
Solution 1:
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.
- Open Project Properties -> C/C++ Build -> Tool Chan Editor
- In the section
Used Tools
replaceAndroid GCC Compiler
withGCC C Compiler
. If section is empty, just addGCC C Compiler
entry in there. -
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 originalAndroid 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
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.