OpenCV Android - trying to make sample application work - java

I am trying to make a basic sample from OpenCV android SDK work (color-blob-detector project).
I have followed all their instructions, downloaded the ADT bundle for windows 7 64 bit, the OpenCV SDK 2.4.9 and finally I imported the samples in my workspace and they appear in my package explorer.
Basically, in my package explorer I opened the OpenCV Library - 2.4.9 and OpenCV Sample - color-blob-detection projects.
In the sample project I receive an error regarding the imports from OpenCV particularly
The import org.opencv.android cannot be resolved
The import org.opencv.core cannot be resolved
The import org.opencv.imgproc cannot be resolved
However, these appear in the OpenCV Library - 2.4.9 project, but I do not know how to refer to them or how to include them in the sample project.
I am a beginner at using eclipse, java or android SDK. Am I missing some obvious step?
Also, on the color blob detector project in the Properties -> Android section, in the Library subsection there is mentioned an undefined reference to ..\..\sdk\java which I do not know how to solve.
Can you point me out how to solve these problems?

You should add openCV SDK lib to your eclipse too which is located in \OpenCV-2.4.9-android-sdk\OpenCV-2.4.9-android-sdk\sdk\java.
Add the project located in that folder as Android Application from Existing Code.

http://www.java2s.com/Code/Jar/o/Downloadopencv241jar.htm
download jar file and add to jar in project properties and then ok press it then all problem slove

Related

Trying to import android project to android studio - This version ... cannot open this project

I am trying to open an already existing android project.
At first inside the main folder there are two subfolders one _MACOSX and another one that contains the android project.
I guess, without being sure, that the _MACOSX folder has files that auto created because probably the project was developed on MAC.
I am just trying to import the project from the second folder and I am getting the following error
This version of the Android Support plugin for IntelliJ IDEA (or
Android Studio) cannot open this project, please retry with version
2021.1.1 or newer.
Does anyone know how to fix this issue? I would appreciate any help
Thank you

Android Studio on Windows, importing and/or adding existing C++ code to a project

I can't import existing C++ code into my Android project.
I'm using Android Studio, Arctic Fox, on Windows 10. A guy sent me his Android Studio project, which includes Kotlin and C++. I imported the project, which has C++ code in it, but for some reason the C++ code did not get included on import. It's in the Windows directory structure, but not visible in the project and the IDE can't find it.
I've provided two images of the project tree structure inside Android Studio. The one labeled #1 is how it should be. The one labeled #2 is how it is. Mine is in the state of #2.
Does anyone know how I can added these files to my project? I tried recreating a cpp folder, but could not find a way. I was going to then recreate the cpp/h file names and add the code by cut and paste from the original project. Although, it would be nice to just be able to import these files and folders.
The correction project configuration:
The wrong project configuration:
Thanks for any help!
I think you haven't install and configure the NDK for read code C++. if you want install and configure the NDK you can read this Install and configure the NDK
Hope can solve your problem :)

How can I convert an android project originally coded in IDEA or Eclipse to Android Studio and add Gradle?

I want to take on a sound recorder project from github: https://github.com/avipars/Android-SoundRecorder
But, it came from IDEA or Eclipse. I tried importing it through github, which didn't work. Then, I downloaded the ZIP and put it in android studio without much luck.
Android Studio won't recognize the file system and I want to get gradle working too.
So, how can I get it in Android Studio with Gradle working?
To clarify, I can get the project in Android Studio. It just won't compile.
Download the project in .zip form, then extract to your preferred workspace.
It looks like the project relies on two external libraries:
android.library.reference.1=../../android-libs/ListViewAnimations/library
android.library.reference.2=../../android-libs/UndoBar/library
Obviously, Android Studio won't know about these libraries while importing this project alone. Remove the above lines from project.properties and add them later into your Android Studio project as dependencies or modules (if you can find them). Otherwise, you can work out the dependencies in the code after importing.
Once you have removed those lines, from Android Studio, you can select "Import project"
Follow the import wizard and you should be brought into Android Studio with a summary of the import result. From there you can muck with .git stuff and add back in any third party libraries that this source code may rely on.
Hope that helps!

How to import Facebook SDK into my android eclipse project

I'm a bit confused between 2 screen in eclipse:
I'm not sure how to import FB sd into my Android project properly.
What does "android" mean vs "Java build path" ?
As current configuration I get this error:
As the error says - there are 2 versions of a jar - android-support-v4.jar. Either make FB use your version of android-support-v4 or use FB's version of android-support-v4.jar in your project. The jar will be in project-name/libs folder.
First import it as a project into your eclipse and then give its reference to your project as you have shown in your first screen. If you have only jars file then add those jar to your libs folder and then follow steps of add to build path.
Delete the android-support-v4.jar from your project as there will be a jar mismatch.As you have added Facebook SDK as a library project, it is again not required to add that support jar file.Facebook SDK already contain that library.If android-support-v4.jar is a older one then you can update it.
You have 2 android support library with different keys.
Right click on your FacebokSDK and project ---> Android tools ---> Add support Library
I don't quite understand the problem, the picture is too small, also, Facebook has a great tutorial about how to do just that, also, make sure you're using Facebook's android support jar.

Can we use Android studio for AOSP development?

Can we use Android studio for AOSP(Android Open Source Project) development, is there a way to do it. I didnt find one. anybody got any idea on this please ?
You can use Android Studio as a IDE for AOSP, since it's just a modified version of InteliJ's IDE.
from AOSP root:
make idegen && development/tools/idegen/idegen.sh
Then just "Open Project" in Android Studio and select the android.ipr it generated.
To import AOSP source in Android Studio or Eclipse, follow the full instructions here :
https://android.googlesource.com/platform/development/+/master/tools/idegen/README
What Pedlar suggested above is one way of doing it. I ran into lot of Jar dependency issues when I tried it with IDEA community edition (Android Studio is a fork of IDEA IDE). The IDE keeps prompting you about duplicate jars etc. The generated project includes framework Java sources as well as App sources. I tried to build an App project which resulted in broken AOSP build. IMHO, IDEA is a great IDE for Java development. But didn't work well with AOSP.
What worked for me is using eclipse to browse/edit/debug framework sources, but build the code from a terminal window. To avoid AOSP build breaks, please create a shadow dir of AOSP (i.e. lndir of AOSP) and use shadow dir for eclipse project.
This is explained at Using eclipse to browse/edit AOSP link in step by step.
If you are working on AOSP, you might want to check Debugging Android framework services.

Categories

Resources