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