Importing an OpenCV project into Eclipse - android

I have imported OpenCV and am able to run all the sample codes. I have to now work on an already built app. How do I import this project? This app uses OpenCV.
EDIT: I am a beginner to opencv for android. The OpenCV tutorials tell me how to create a new project, not how to import it.

If the project is already from another eclipse and the versions are compatible, you can move the project folder into the workspace folder on the file system, copy/paste into the project explorer (Java Perspective) or use the 'Import > File System' function.
If the project is a bunch of raw project files, you can use the 'File > Import..' function in eclipse, choose '..Existing Project..'
Then you should be all set.
If you're starting anew with just .java files and android xml etc. You'll then need to include the the OpenCV project in the workspace and add the project to your app's project, as listed here from OpenCV's documentation of "Using the Android Binary Packages":
"Do the right mouse click on your app in Package Explorer, go to Properties ‣ Android ‣ Library ‣ Add "
Here's the link for that:
http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/android_binary_package.html

import it to the workspace.AS usually you import any other project.If there is any error share the error.I think this is the correct way.

Related

Trying to add opencv to a flutter plugin

Trying to add opencv to a flutter plugin. I have tried to follow example by Sawan Kumar Bundelkhandi. When I did an import module of OpenCV into the (java) project, it only shows me a name of :Java, not anything like openVClibrary4.0. Maybe that is my first problem.
Later, I cannot add the libs directory to the java project. I tried various right click, create Directory, but nothing seemd to be created. I did a copy in Windows explorer, and renamed it to jnilibs, but I cannot make the Android Studio project see that directory.
Any suggestions where I could look for more information?

Android Studio, Sample Code - Not working

There is sample code on the developer site that i wish to run.
When I import as a new Android Studio project, I'm not given any ability to run the code (disabled buttons).
I attempted to copy the source files over into the shell of a new project, but i than got errors that didn't make sense. reference to duplicate declarations in source files that had nothing relating inside them.
Is there an idiots guide on how to properly use android studio, or is it just this difficult?
In order to correctly import the project, you should follow the Samples guide as found in the developer docs.
To import a downloaded project:
Unpack the downloaded project package.
In Android Studio, chose File >
Import Project and select the root folder of the unpacked project.
Android Studio may ask you to choose the type of project you are
importing.
If this is the case, make sure to choose Import project
from external model and select the Gradle option.
Alternatively, if the Gradle option does not work, I would attempt to use the Eclipse option.
Open .gradle file when you import the project, not the folder of the proyect.

How to add library project to an existing android project in AndroidStudio

how can I add a custom library project (in my example the CuXtomCam library) to an existing android project using Android Studio 1.1?
I've read about changing the build.gradle file. But where should I place the library ressources?
Thank you in advance for all answers and comments!
To import library into Android Studio:
select File > Import, and then select the directory containing the project to import.
a wizard will open and guide you through the rest of the import process.
When the project import has finished, it will open up a file called "import-summary.txt" which lists all the steps taken during import and suggestions for next steps. For example, it may note files that were not migrated, it may note missing components in your SDK install, and so on.
Just right click on the project then New>Module. from the new window select Import existing project. Give the directory. I think this will help

How to correctly import an Android library with JNI code?

Background
I've made a tiny SDK for bitmap handling using JNI (link here).
It has only 2 projects : a sample project (demonstrates usage of the SDK), and the SDK itself .
The SDK project is an Android project, and it includes some C/C++ code within it.
The problem
For some reason, even though when I've created the project , everything went fine, now that I try to get the library project and import it to Eclipse, and then I open the CPP file I've made, I see plenty of errors on it, as such:
The question
Why does it occur? How do I import the project correctly? Can I help whoever is using this to be able to import it nicely?
I've tried to create a totally new project with JNI and just copied (carefully) the files from my library, and it compiled fine, but that's not a nice way to import a project...
This eclipse error happens often , and your solution (starting a empty project then adding the files) is the fastest work-around, and we all use it when it comes to this.
Another solution would be to remove the c nature and Android nature and add again these natures to the project (often times this works as well).
When a new project is created, Eclipse will add it's natures and it's tool chains. If you import an old project, these toolchains / natures might be badly imported.
For a project containing c and c++ , you will need to have cnature and ccnature defined in your ".project" file. For android you need Android Nature.
For compiling android, you will need to have com.android.gcc as the toolchain defined in your .cproject file.
Depending on the version of ADT / CDT / Eclipse , the value from the toolchains in .cproject differs, hence they aren't easy to import from machine to machine.
My guess is you have your storm of errors because the .cproject file was generated wrongfully .
EDIT
After Android Developer's further research, a faster way to bypass Eclipse's limitation caused by how native nature is added to a project can be done in the following steps:
delete from the ".project" file the "cnature" and "ccnature"
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
delete the ".cproject" file from eclipse workspace
remove all generated files and folders : libs, obj, gen and bin
Re-add the native support for android via the "android tools" context menu
Thank you android developer.

How do I build these libraries from GitHub

I'm having a lot of trouble figuring out how to build a jar of the Showcase View library so that I can import it into my application.
I've searched all around but can't find a process for it. I tried importing into Eclipse but I can't get it in there since it isn't a project and I'm not sure what type of project to create from source with.
Any help would be greatly appreciated.
Easiest way is:
Create an empty Android Application project in your Eclipse workspace.
Copy files in ShowcaseView/library/ folder of github to your new project base folder.
Refresh project in Eclipse.
Goto project properties - Android and select "Is Library"
Clean unnecessary stuff and build.
It should be ready to add as dependency of your app.
Alternatively you can pick another library project .project file and copy it inside this library folder, edit it to match your new project name, etc... And then import in Eclipse. But this is more hardcore if you don't know what you're doing.

Categories

Resources