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.
Related
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.
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
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 am working with Android API 17 on eclipse Indigo. I have cloned the faccebook sdk from github and done the facebook library project set up using the source project provided in the fb sdk.
Now I'm trying to include this library project in my android demo project. I have added it under Project properties->Android->Library section. Im seeing green color tick mark infront of the added library.
Also, i have added the same in the Project properties->Java build path->Projects.
build is successful. but when i try to install on my AVD, im getting the error, E/AndroidRuntime(748): java.lang.NoClassDefFoundError: com.facebook.android.Facebook
Can anybody plz help me how to fix this issue.
---- EDIT ------
One more thing I have observed is, when i opened Project properties->Android window, the green tick mark is not displaying under Library section, instead I'm seeing red cross mark.
Any ideas?
Thanks,
Venkat Papana
Same thing happen for me also.. try below .. it will work..
A Best way to add External Jars to your Android Project or any Java project is:
Create a folder called libs into you project root folder
Copy your Jar files to the libs folder
Now right click on the Jar file and then select Build Path > Add to Build Path, this will create a folder called Refrenced Library into you project, and your are done
By do doing like this, whenever you transfer you project to other Computer, you will not miss your libraries which are being referenced to some space on your Hard drive.
(The facebooksdk.jar can be found at the facebook-sdk directory: <facebook-sdk>\facebook\bin)
i know this question is old But I thought that may be it can help someone.
Move the library project and the application on the same drive. Usually this is a bug in Eclipse.
I solved my problem by moving them in same drive on my computer.
You can Give it a try.
You need to make both project in same dictionary then include it using Project Properties -> Android-> Library.
This works fine.
You do not have to add this to the library project as this is not the library.
https://github.com/facebook/facebook-android-sdk is the help of the project ad the sample code for the including the project in our code. Just you need to create the app ID for the facebook by registering your api with it.
Hope this will help you in your project.
Resolved by copying the com.facebook.android source code to my project source.
When I select the properties to my project then go to Android and add a new Library, the eclipse automatically create a Android Depencies that contains all my .jars.
It does not add the new project to the list of referenced packages. When I try to Run the application I got the error: Conversion to Dalvik format failed with error 1. When i realize I have the .jars that i added both in the Android Dependencies and my /gen.
When I delete de Android Depencies I got error in my classes, saying that i´m not referencing the specifics .jar... But I have them in my /gen past.
Any Ideia how to make the eclipse refer to just one .jar?
Library is a special android feature that allows you to use an apk or another android project where you would for example share some code. It's detailed here :
http://developer.android.com/guide/developing/projects/projects-eclipse.html
I think that what you want to achieve is just adding a jar as a dependency which can be done with Project > Properties > Java Build Path > Libraries Tabs > Add Jars / Add External Jars.
tl;dr :
Project > Properties > Java Build Path > Libraries != Project > Properties > Android > Library
I did these steps to make my app work with the lib-sources using adt 17
add "lib-sources-project" to workspace
import/general/existingProjectsIntoWorkspace
mark this "lib-sources-project" as android library
lib/Properties/Android/IsLibrary must be checked
Add lib to main app
app/buildpath/ConfigureBuildPath/Projects Add "lib-sources-project"
app/buildpath/ConfigureBuildPath/OrderAndExport set check for "lib-sources-project" so your lib will be included into the buildresult
app/Properties/Android/Library Add "lib-sources-project" to the list.
Note since adt 17 you can have resources in your "lib-sources-project". Android Lint will tell you what you have to change to make it work.
Hoever i haven't succeeded yet to include a jar with resources without adding "lib-sources-project" as described above.
Maybe somebode knows how to do this.