Trying to add opencv to a flutter plugin - android

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?

Related

Using libGDX in Android Studio 1.0.2

I successfully imported a "testgame" project into Android Studio using the build.gradle in the root directory of where libGDX populated the project files.
Within the root directory, I noticed there is an "android" sub-directory that also has a build.gradle file and includes other sub-directories for different files that are specific to android. The different files include assets, libs, etc.
When I try to import that build.gradle file into Android Studio, it does not display the proper class and manifest files needed for the game.
I tried to search for what a successful import should look like in Android Studio, but had no luck.
Has anyone successfully used the libGDX framework within Android Studio?
I tested a demo on libGDX on Android Studio 1.0.2 and it worked, the following link leads to my screenshot showing the version of my AS and the output from an emulator
https://www.facebook.com/yaten.Notes.Android/photos/a.438504762964810.1073741827.438486782966608/438689702946316/?type=1&theater
Sorry, can't post screenshot directly, I need 10 rep to do that.
It sounds like you were right the first time, but then tried to import another file.
The build.grade file in the root of the project is the correct file to select when importing into Android Studio.
This is in line with the official wiki instructions, as Android Studio (at least through the current 1.1.0) is built on top of Intellij.
Once you've imported that project you should automatically be able to run on Android, as a configuration will have already been created.
It is incorrect to import any of the other build.gradle files, such as the one in the android directory that you tried to load.

Importing an OpenCV project into Eclipse

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.

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.

Can't open Project in Eclipse

I ma trying to open the source code of Gallery2 application in of Android in Eclipse and for some reason I am not able to open it.
I did Open> Android project from the existing code and selected the Gallery2 folder that I downloaded. As soon as I do that, i see the following screen:
As we can see that next button is disabled, Finish button is disabled and it says "Select atleast one project even though the project is selected". I am not sure what to do.
Or let me ask the question another way. I have successfully imported project into my workspace. What do I do now? I am fron Visual Studio world and ideally I should be looking for a solution file and that will open the entire project. How does that happen with java Android file?
Any ideas?
Because there is already project whose name is same GalleryActivity/Gallery2 or project which have same package name already imported in your eclipse workspace.
Check all the imported projects in your eclipse project explorer
This similiar error happened to me when I imported a standard Java project, I knew it was a java project but Eclipse didn't think so. It turned out that my project was missing the project.properties file and because of that Eclipse didn't recognize my project as a Java project. In the end I imported it as default project and added java facets to it, that did the trick. I don't know if this is your case but it may be worth to have a look at it, eclipse is a bit pedantic when it comes to things like this.
you have already imported same named project in your workspace. so first check your workspace and if exists delete it. or create another workspace and try to import the project

Android: Unable to include facebook sdk library project

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.

Categories

Resources