Android with OpenCV - android

I'm trying to use opencv for android on my image processing application. I configured opencv library and it works well with the sample projects. When I try to run my own project using opencv, I get "Android Library Projects cannot be Launched". I have checked the Project properties ,is Library is checked for my project for the openCV library,Cleaning the project does not help either.
Please help me.

The steps to configure OpenCV4Android library for your projects:
Import the OpenCV library project to your workspace.
Go to OpenCV library project->Properties->Android.
Mark the "isLibrary" checked if it is not.
Go to YourProject->Properties->Android. In Library Section click on add. select OpenCV Library from the list.
Do your necessary codes in your project and compile it.
If you need more details, You can get from here. Remember, your project should not be marked as library project. So don't mark the isLibrary checked in your project properties.
Thanks.

Related

How to import android studio library project from github to eclipse stackover?

I have some troubles when i try to add a android studio library to my eclipse project.
Create android project from existing code
Mark as library
Go to my project and adding the library.I see that the project(library) not found
enter image description here
Pls, any ideas?
It's not possible. We intend to add support for Gradle-based project in ADT but it's not currently possible.
you have to Manually as shown bellow
http://www.101apps.co.za/index.php/articles/importing-android-studio-projects-into-eclipse.html

How can I use a project source code as a library for an another project?

I am a beginer in android.My client gave me a project source code(using native libraries) as a refference.Is there any possibilities to use these source code as library for my android project? If it is possible,how can I access methods of these library file? any one please help me..
Import the project into work space. Right click on the project in eclipse. Goto properties. Choose Android. Check if Is Library chexk box is ticked. If not tick the same. This is a library project now.
To refer the library project in your android project.
Right click on the project in eclipse. Goto properties. Choose Android. Click add. Browse the library project and add the same.
Clean and build.
For more information check the link
http://developer.android.com/tools/projects/projects-eclipse.html
Information regarding library project
http://developer.android.com/tools/projects/index.html
If the Android development tools build a project which uses a library project, it also builds the components of the library and adds them to the .apk file of the compiled application.
Therefore a library project can be considered to be a compile-time artifact. A Android library project can contain Java classes, Android components and resources. Only assets are not supported.
To create a library project, set the Mark this project as library flag in the Android project generation wizard.
To use such a library, select the generated project, right-click on it and select properties. On the Android tab add the library project to it.
The library project must declare all its components, e.g. activities, service, etc. via the AndroidManifest.xml file. The application which uses the library must also declare all the used components via the AndroidManifest.xml file.
Other projects can now use this library project. This can also be set via the properties of the corresponding project.
Please check this
To create a library project, set the Mark this project as library flag in the Android project generation wizard.
http://www.vogella.com/articles/AndroidLibraryProjects/article.html

How to add external libraries to my application in android

I have an application that I have to look at as a training exercise. It has used few external libraries such as SlidingMenu, ImageViewZoom and ActionbarSherlock.
I have downloaded and extracted those libraries but I have no idea how to add them to my existing project.
For those that are distributed as a simple JAR, do what Emil Adz indicates, and copy that JAR into your project's libs/ directory.
For those, like ActionBarSherlock, that are distribute as Android library projects, you will need to do a bit more work. In the case of Eclipse, you will need to import the library project into your workspace, then go into Project > Properties > Android for your application project and click the [Add] button to add the library project to the application project. For a command-line build, use android update lib-project to link the application and library project together.
You can read more about referencing an Android library project from Eclipse or the command line in the documentation.
You need to import those libraries as Android Project from existing source and mark them as "Is Library" by going into their properties.
Once you marked it as "Is Library" add it to your
project by going into Properties->Android->Library->Add (it will show the list of library you imported).
The Right Way:
What you need to do is to copy the external library (JAR file) to the /libs folder of your project.
That way those libraries will compile with your project and could be use on real device when you deploy your application.
Some times you will need to add a project to your workspace ( For example the Google Map library)
and then add the library reference using the properites -> Android window at the bottom.
You can get an idea of how it's done by reading the first 3 step of this Google Map API V2 guide I wrote. there I reference the android library project:
Google Map API V2 Guide
The Wrong Way:
any other way, like for example adding the files using the properties - > Java build path screen may result in a missing library when you run the project on a real device.
if they are jars the make a libs folder then paste the jar in it and then go to your project buildpath->configure build path->Add Jars-> ok and if it is a library project then go to your project Property->Android->Add(Your Lib Project)->Ok->Apply

Eclipse will not recognize project as library (ActionBarSherlock/ViewPagerIndicator)

I'm trying to get ActionBarSherlock and the ViewPagerIndicator libraries set up for my projects, but I seem to be running into a few issues. I sent Jake Wharton (The developer) a few messages earlier about it, and got a few replies but couldn't get anywhere - and I think he got busy with a few other things.
What my issue is, For both VPI and ABS
Both libraries open up without any errors, and I'm using compiler version 1.6 for all as is required.
The funny thing is, if I load in the samples that are provided - they work fine and link to his library; but when I go to add the library to my project - the above happens.
Where to store the actual library project does not matter, as long as you use a relative link to reference it. Check out the Library Projects - Development considerations:
Library project storage location
There are no specific requirements on where you should store a library project, relative to a dependent application project, as long as the application project can reference the library project by a relative link. What is important is that the main project can reference the library project through a relative link.
You should always use the Eclipse ADT plugin to select and set up Library Project Reference, i.e. right-click project -> Properties -> Android -> Add, then in the opened Project Selection window, select the Library Project list here (of cause you should import them in the same Eclipse workspace as your Main Project). This will add a android.library.reference using relative path into project.properties as well as show relative path in the Android preference window:
android.library.reference.2=../../../../../Documents and Settings/yorkw/Desktop/JakeWharton-Android-ViewPagerIndicator-f09acb0/library
If you directly alter it using absolute path from project.properties as below:
android.library.reference.1=C:\\Documents and Settings\\yorkw\\Desktop\\JakeWharton-Android-ViewPagerIndicator-f09acb0\\library
Then after Eclipse refresh your project, you get the exact error described in your question, see my screenshot below:
Hope this helps.
While importing the libraries, make sure that you tick the "Copy projects int workspace" check box. The library projects need to be in the same workspace for them to work.
delete and import the project and lib again. build the lib project , add lib to project, still error shows.. rename the lib project. this worked for me ....

I'm having some trouble adding OpenCV to a new Android project

I have made modifications to several example OpenCV projects within Android, however I am having some issues with using OpenCV successfully in a new Android project.
The documentation on using OpenCV with Android says to complete the following steps to add OpenCV to an Android project -
ensure the Android project is in the same workspace as OpenCV
add a reference to the OpenCV project by going to Properties > Android > Library > Add and choosing the OpenCV Library project
I have followed both of these steps, however when I compile my application I receive the console error -
Could not find OpenCV-2.3.1.apk!
When creating a new Android project, the only thing you need to do is
add a reference to the OpenCV project by going to Properties > Android > Library > Add and choosing the OpenCV Library project
You should not then explicitly add OpenCV Library project into your new Android project's build path:
add another reference to the OpenCV project by going to Properties > Java Build Path > Projects > add...
If you do latter step, you will get the exact error Could not find OpenCV-2.3.1.apk! described in the question.
Check out the New Android project's build path and remove OpenCV project if it exists, then give it another try and see if this helps.
When you add OpenCV from Properties->Android->libarary->Add you need to leave "Is Library" checkbox unchecked. Go to Project->Properties->Android and uncheck "Is Library" and then try again. It should solve your issue (it did for me) but if it doesn't please take a look at the answers of this question as other people have found some other things to be helpful as well.
I had this problem when I pulled in the jni_part.cpp file from a sample project. I forgot to change the names of the functions to fit the package name of the class I was using them from:
JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial3_Sample3Native_FindFeatures ->
JNIEXPORT void JNICALL Java_<CLASSNAME_WITH_UNDERSCORES_INSTEAD_OF_DOTS>_<CLASS_NAME>_<METHOD_NAME>
Hope this helps someone.

Categories

Resources