I am trying to build an NDK project but I am facing an error. The reverse function couldn't be resolved in a project using JNI with NDK Android, which you can see in the attached image.
I have added the path in project properties at path and symbols section --->see screenshot for this too.
Related
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
This is a common problem when you try to edit a C/C++ file inside a JAVA workspace/perspective without the proper configuration. You can simply select all the entries in the Error Log and delete them.
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 :)
I imported an existing Android project to my Eclipse.
I get an error in the project that prevents me from building:
I get this message in "problems":
Program "/opt/adt-bundle-linux/android-ndk-r8e/ndk-build" is not found in PATH
and the problem type is: C/C++ Problem.
I have a windows machine with Eclipse (ADT) and Java up to date and I suspect that the original project where this project was built, is different (perhaps it is Linux?), or perhaps it makes use of native code and my Eclispe is not configued to support it. I don't have such an issue with other projects in my Eclipse...
Please, advise....
thanks.
as Chris Stratton stated, this project is made on a Linux machine.
You can change your PATH if you go to: Project -> Properties -> C/C++ build -> Environment
You can edit PATH there. After you've deleted that "/opt/.." you should add the path of your own ndk-build. If you don't know what ndk-build is take a look over here: https://developer.android.com/tools/sdk/ndk/index.html
Im trying to use face dection code of opencv on android
but there are some problems even i clean the project like the others said.
here is the description on the eclipse
The project cannot be built until build path errors are
resolved OpenCV Sample - color-blob-detection Unknown Java Problem
The container 'Android Dependencies' references non existing library
'C:\OpenCV-2.4.3-android-sdk\sdk\java\bin\opencv library -
2.4.3.jar' OpenCV Sample - color-blob-detection Build path Build Path Problem
Its mostly a problem with the path.
Have you checked the path correctly? (Jones suggestion should work for you)
If its correctly set... I would ask you to check the make file in JNI folder and use this full path, and also check the build path -> C++ -> GNU C++ -> add this path (if not already added).
Then you should be able to get this to work.
There isn't any .jar to import.
If you follow openCV tutorial (http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/O4A_SDK.html)
and import all Samples and Library you should be sure that Library project can be built without error.
In my case I have just set the Android Target at the current release 5.1.1.
To do that, right click on project "OpenCV Library - 2.4.11"->Properties->Android->Select Android 5.1.1->Apply
Used software:
Visual Studio 2012 Express
cocos2d-x 2.0-x-2.0.4
cygwin 1.7.5.
Eclipse 3.8
Android SDK last
Android NDK r8c
I am new in development for Android, so don't understand what is wrong.
Trying to build cocs2d-x standart testcpp project.
First trouble was when when i runned create-android-project.bat - it didn't shows target versions of Android (target - v.2.3.3.), but all paths are correct.
At last it build project folder. But next step - building pack in cygwin - fails in case of hundreds of "file or folder not exists" errors of headers, didn't uses a lot of STL headers and ask for <string.h> but not just <string>.
What am i doing wrong?
set NDK path in build_native.sh file in android project folder, then excute build_native.sh by using cygwin
You must rename APPNAME variable in build_native.sh same to your eclipse project name
try to update android-NDK, I have same error using NDK-r8d, and try to execute build-native script too.
According to following article,
http://opencv.itseez.com/doc/tutorials/introduction/android_binary_package/android_binary_package_using_with_NDK.html#android-ndk-integration-with-eclipse
I was able to successfully build and run some of OpenCV samples - ndk and jni are also working fine. But for the other projects, I got red flags saying
the project cannot be built until build path error resolved.
But I can't find what the build path error is. I looked at the configuration of build path, I don't see a problem. I note that those failed projects have all empty OpenCV-2.3.1_src folder. Can someone experienced with this help me?
UPDATE:
I think I am hasty. I removed source reference of that empty folder from build path and it's building now.