OpenCV Android Studio Set-up problems - android

I am trying to use opencv in android studio but am having some problems. I have searched the forums but couldn't find this exact problem. I am clicking file > import module and entering the following file path: OpenCV-2.4.10-android-sdk\sdk\java
I then receive an import summary like this:
ECLIPSE ANDROID PROJECT IMPORT SUMMARY
Ignored Files:
The following files were not copied into the new Gradle project; you
should evaluate whether these are still needed in your project and if
so manually move them:
javadoc\
javadoc\allclasses-frame.html
javadoc\allclasses-noframe.html
javadoc\constant-values.html
javadoc\help-doc.html
javadoc\index-all.html
javadoc\index.html
javadoc\org\
...
the summary includes a lot more libraries that are not included but I didn't want to list pointless additional information.
...
Moved Files:
Android Gradle projects use a different directory structure than ADT
Eclipse projects. Here's how the projects were restructured:
AndroidManifest.xml => openCVLibrary2410\src\main\AndroidManifest.xml
lint.xml => openCVLibrary2410\lint.xml
res\ => openCVLibrary2410\src\main\res\
src\ => openCVLibrary2410\src\main\java\
src\org\opencv\engine\OpenCVEngineInterface.aidl => openCVLibrary2410\src\main\aidl\org\opencv\engine\OpenCVEngineInterface.aidl
Next Steps:
You can now build the project. The Gradle project needs network
connectivity to download dependencies.
Bugs:
If for some reason your project does not build, and you determine that
it is due to a bug or limitation of the Eclipse to Gradle importer,
please file a bug at http://b.android.com with category
Component-Tools.
(This import summary is for your information only, and can be deleted
after import once you are satisfied with the results.)
Can anyone help me with this issue please?

Even if ".html" files are not copied the code will work.
Instead of importing path:"OpenCV-2.4.10-android-sdk\sdk\java" import any one of the samples from the opencv sdk 4 android and the libraries will be imported automatically eg:-(path:"OpenCV-2.4.11-android-sdk\OpenCV-android-sdk\samples\15-puzzle") then you can always remove the module from properties.

Related

eclipse + eclim + android support library

I have an android gradle project which I compile from the command line. I am using eclipse + eclim to have autocompletion and source code validation. I was an unable to get code completion to work by importing the project as an gradle project into eclipse. I therefore imported /path/to/gradle/project/app/src/main as an android project into eclipse and after some .classpath tweaking I was able to get autocompletion to work.
Now I wanted to import the following android support libraries:
import android.support.annotation.NonNull;
import android.support.v13.app.FragmentCompat;
import android.support.v4.app.ActivityCompat;
but got The import ... cannot be resolved error for all three lines. I then tried Android Tools -> Add Android Support Library which failed miserably. I then tracked down the libraries in question in the Android-SDK and added them manually to the Java Build Path in Eclipse. For some I needed to extract the JAR files from the AAR files as described in this answer. I added the following libraries:
appcompat-v7-26.0.0-alpha1.jar
support-annotations-26.0.0-alpha1.jar
support-v4-26.0.0-alpha1.jar
support-v13-26.0.0-alpha1.jar
This solved the problem for the the first two imports but I still get the error for import android.support.v4.app.ActivityCompat;. I have code completion up to v4 but app is not found.
How can I resolve this issue? Am I still missing some dependency? Is there a better way to get android code completion with eclim?
So i figured it out myself. There was still a dependency missing. In my case I also needed
support-compat-26.0.0-alpha1.jar
I wrote this script to extract all the jar class files that are somewhere hidden in the android-sdk/folder. It recursivly looks at all subdirectories of the specified Android SDK folder until it either finds a JAR file which is not Javadoc or Source and copies it to a destination directory. If an AAR file is found the content is extracted to a folder of the same name as described in the link of the question and the JAR file in that folder copied with an appropriate name to the given destination directory.

Github project import to Android Studio : Migrate Project to Gradle? This project does not use the Gradle build system

First of all This is not a duplicate of any of below questions
Migrate project to gradle error
Can't migrate project to Gradle in Android Studio
This project does not use the Gradle build system. We recommend that you migrate to using the Gradle build system
Android Studio Import Project Error
Now let me talk about the problem. I've downloaded a zip file of GitHub project file to build on my laptop. The name of GitHub project is "VNCpp" As I'm not allowed to insert more than 2 links, I have given the project name so someone can search.
When I import this project into my android studio, it gives me this error : "Migrate Project to Gradle? This project does not use the Gradle build system. We recommend that you migrate to using the Gradle build system"
Edit: Android Studio has built in facility to import eclipse project and convert it into gradle build format. But in this case, it is not happening.
I'm getting 2 options while importing the project 1)Import from available sources and 2) Import from external model i.e gradle
When I select Import using external model it shows error like in this image:
gradle path error
And when I select Import from existing sources it creates some file system that doesn't have gradle structure. So I cannot edit and build the app on studio :
File system without gradle structure
What should I do now to properly import the project ?
I solved this problem after reading carefully [the documentation(https://developer.android.com/studio/intro/migrate.html).
Clone the project from GitHub
Close all Android Studio projects.
From the Android Studio welcome screen, click Import Project (Eclipse ADT, Gradle etc).
Select the project folder with the AndroidManifest.xml file
Click ok.

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.

Can't import library project into Android Studio project

I'm writing a library project to create a component that's going to be used in some, if not all, of our projects. I wanted to test how it's going so far, but I can't import the library project into my other project.
So, I created my library project called SplashScreen with Android Studio. Now I've created the project SplashScreenDemo with an Activity that should use the component I wrote in the library project. But the import wizard doesn't let me choose the project and all the info I find online is to import into Android Studio your old Eclipse library project, but in my problem Eclipse isn't involved at all.
So far I've tried:
Right click on project root > New > Module > Import Existing Project
File > Import Project
File > Import Module
This is the window (and that's the path to my library project):
I've tried several paths, none of them working:
/Users/dgc/AndroidStudioProjects/SplashScreen
/Users/dgc/AndroidStudioProjects/SplashScreen/SplashScreen.iml
/Users/dgc/AndroidStudioProjects/SplashScreen/build.gradle
/Users/dgc/AndroidStudioProjects/SplashScreen/app
/Users/dgc/AndroidStudioProjects/SplashScreen/app/app.iml
/Users/dgc/AndroidStudioProjects/SplashScreen/app/build.gradle
Any ideas? Am I missing something?
P.S.: Versions:
Android Studio 0.6.1
gradle 1.10
Android plugin 0.11.+
I think what's happening is that you're trying to import a module that has the same name as an existing module and it's not giving you any indication of what's wrong. Actually, if you enter just the path to the parent project so it will show you a list of modules you can import, and those modules can't be selected if you hover over one, it will show you the error message in a tooltip:
Obviously that's not very helpful, and I've filed a bug asking for improvements:
https://code.google.com/p/android/issues/detail?id=71942
To work around it, you'll have to rename either the module you're trying to import or the module in your project. To do that you can right-click on it in project view, choose Refactor > Rename > Rename directory.

Why can't android projects be imported into eclipse?

I have a root directory with a number of android eclipse projects inside. They all have .project files, but eclipse does not seem to see them as eclipse projects? Does anyone know the reason why?
Cause for not importing projects in eclipse :
Reason 1 : Project Structure Differs
Reason 2 : Project Configuration files missing or not available
Reason 3 : Project can be already exists in workspace
Reason 4 : Don't have Proper and Standard Naming Convention
Follow these steps.
Hope you have android sdk and ADT plugin for eclipse.
File-->Import-->Android-->Existing Android code into workspace.
Then import the projects from your root directory using Browse button. If you don't have ADT plugin definitely you never import your android projects.
You have to import them manually
First File > Import
Then General > Existing Project Into Workspace
Either select root directory or Select archive file, click Browse to locate the directory or file containing the project that you want to import
Under Projects select the project that you want to import
Finally click finish to import the project
Here is a link to the eclipse help section on this
http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-importproject.htm

Categories

Resources