Building OpenCV samples - android

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.

Related

Android studio: Builded jar file not generating some class files

Hi i downloaded the vector chat application from this link and i
imported it as a superate project (By using java 1.7 sdk only it was
working).
As a superate project it's working perfectly then i imported (by
copying manually) this project to my personal project then i got some
error, by spending some time i resolved almost all errors but now i'm
getting the error as cannot resolve symbol RoomPreviewData.
This RoomPreviewData class file was generating in the jar file in
vector project (inside of build folder) but in my personal project
it's not generating the RoomPreviewData.
For understanding i'm attaching the images to this question. So, any
one please help me to solve this
Vector project image
Failure project image
Am I getting it right that you're building Matrix SDK artifact by yourself and then importing it into the project? If so, please validate build logs and also see if the file was actually packed into artifact (actually, you may even inspect it as an archive)
Alternatively, you can pull whole package's code from that link and then load it as is into the project
I don't think this was the exact answer, but i'm posting here because it may help others.
I changed the package name of vector project as my personal project (For changing package name fallow these steps)
Imported (Just copy and paste) my personal project into vector project
then everything working fine......

Compiling Hello-Jni failure in eclipse only when opening the hello-jni.c file in eclipse

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 :)

Error in OpenCV Android eclipse setting up sample projects

I already watched so many tutorials online but I can't figure out what's wrong with the sample projects given by the openCv.
I also follow the steps given in this link : sample question
The error in 15 puzzle is different from camera-calibration and color-blob-detection.
After I deleted the error lines in JavaCameraView.java file, some of the samples start to works fine.
My ndk version is r10 and OpenCV version is 2.4.9. I hope someone can help me solve my problem. Thanks in advance!
You can look at this sample. Basically you will just need to redirect the library to your folder
After some configurations, I finally figured out how to solve my problem. Here are the steps:
First: Click on every folder->Properties->Android->Delete the unknown reference then add the OpenCV library.
Second: Make sure to link the C/C++ Build by Properties-> C/C++ Build-> Then copy the file path of your ndk folder
Third:copy jni folder present in face detection or other projects then paste it to a project that don't have a jni folder.
Fourth: Change the include declaration to local library of OpenCV.mk in Android.mk file.
Ex. include C:/Dev/OpenCV-2.4.9-android-sdk/OpenCV-2.4.9-android-sdk/sdk/native/jni/OpenCV.mk
Fifth:Make sure to clean and build the project.
Finally run every project on your device. cherio!

Eclipse LogCat unreadable - OpenCV / Android NDK

I'm pretty new to Eclipse and Android dev and only recently installed NDK and OpenCV and ever since I've been battling. Win8/Eclipse Juno/NDK R8D/OpenCV 2.4.4
Project folder has this red exclamation mark but no files within are showing any errors.
CDT builds the app just fine!
Here's what LogCat gives me:
Any clue? Cheers
EDIT:
after I followed your advise I ended up with the following:
Description Resource Path Location Type
Project 'OpenCV Library - 2.4.4' is missing required library: 'C:\Program Files (x86)\Android\android-sdk\platforms\android-17\android.jar' OpenCV Library - 2.4.4 Build path Build Path Problem
The container 'Android Dependencies' references non existing library 'C:\Android\android-opencv-2-4-4\sdk\java\bin\opencv library - 2.4.4.jar' Test1 Build path Build Path Problem
If the project folder is showing a red exclamation mark, try going to window > show view > problems and there may be a better description there of any problems.
The log above looks like a general log from your device. If you want to log from a specific running application, run the app on a device from eclipse and type app:com.yourpackagename in the text field above the LogCat output.

How to resolve build path errors?

If I run my project this error will come build path problem how to solve this error.
error:
Description Resource Path Location
Type Project 'videothumb' is missing
required source folder: 'gen'
videothumb Build path Build Path
Problem
The project cannot be built until
build path errors are resolved
videothumb Unknown Java Problem
Can any one help me?
Try to clean project and if it still doesn't help close and then open project.
IF you are using eclipse then do as follows:
right click your project.
select build path-->configure build path.
update all the broken links in all 4 tabs.
Go to project-->clean [project will be found at top menu of eclipse.]
Clean your project.
Its done. For any further explanation comment on my answer.
Hope this helps.
Edit:
Here you go:
As you can see i'm at source tab of configure build path and i have only one folder here named ATalk/Src. likewise you can have number of folders.
Check for red cross mark on folder. if its there then your folder path is wrong means link is broken for that folder.
Same way you can check in Libraries tab. There you will find list of jars in your project. If any of them have red cross then its path is missing. So update all such red cross paths.
As you can see i dont have a red cross on my folder means it is at correct location.
Hope you get my point.
EDIT:
I just noticed that, according to your screenshot, the problem seems to be that the adb tool is not found. Now I might be wrong but I think that as of Android 2.3 (maybe even earlier) the adb tool is expected to be in [path-to-your-sdk]/platform-tools folder, not in the [path-to-your-sdk]/tools folder. The later path was used in earlier SDK's and your problem might be caused by such a simple thing that you have an outdated Android plugin in Eclipse.
OLD, IRRELEVANT ANSWER:
I've seen these kind of issues in Eclipse environments when I have some kind of error in my XML files. Malformed errors (that violate the rules of the XML structure) are often treated as "syntax errors" and are shown directly when you write them or when you try to build your application.
Other errors, however, like giving invalid references (giving a dimension where an integer is expected, for example) are not always highlighted with file name and failing line number (I'm not sure if this is bug in Eclipse's android plugin or even if it's a bug at all).
These kind of errors you'll have to hunt down manually and rebuild your project (as dcave555 sugested). This is really boring work if you have many XML files with many changes in
I think the path should look like this: /home/embdes/projects/android/android-sdk-linux_86
The problem is because of your Android build path settings. Try to check:
Window > Prefereces > Android > Build path
it should properly set to your Android SDK

Categories

Resources