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
Related
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.
Am trying to add google-play-service library in my project using import(For Google map). After adding the path am getting red X next to this reference and the reference is not adding . Know how to resolve this ?
The red X means its a broken link path.
http://developer.android.com/google/play-services/setup.html
Copy the google-play services_lib library project to your workspace (folder where your android map project is). The library project can be found under the following path.
<android-sdk-folder>/extras/google/google_play_services/libproject/google-play-services_lib library project .
Import the library project to your eclipse
Click File > Import, select Android > Existing Android Code into Workspace, and browse the workspace import the library project. You can check if it is library project. Right click on the library project. Goto properties. Click Android on the left panel. You will see Is Library checked.
Right click on your android project. Goto properties. Choose Android on the left panel. Click on Add and browse the library project. Select the same. Click ok and apply
Eclipse does weird things when importing an existing project (google-play-services-lib), especially if you try to import and then allow the project to be automatically 'copied' to your workspace. I had the same issue and here is how I fixed it:
Close Eclipse
Erase all google-play-services projects from your workspace
Manually copy the google-play-services-lib folder (....sdk\extras\google\google_play_services\libproject\google-play-services_lib) into your workspace
Open Eclipse
Add a new project, choosing 'Existing Android Project', then navigate to your workspace and add the newly copied google-play-services-lib project
Finally, add the google-play-services-lib to your project as a library (just like you normally would)
Hope this helps! :)
Though it's over a year for this question but never the less thought of putting it down here. Might help some one facing a similar issue.
While doing a File -> Import one probably might have selected the folder,
C:\adt-bundle-windows-x86-20130729\sdk\extras\google\google_play_services\
instead of
C:\adt-bundle-windows-x86-20130729\sdk\extras\google\google_play_services\libproject\google-play-services_lib
Quite strange as Eclipse did not correctly copy the google-play-services_lib project in my workspace, but this caused a cross mark to appear in my Project Properties.
got a perfect solution for your question. this problem is due to improper referencing of library projects. You need follow these step.
create a new project
copy all the java files from src of your previous project in which you are getting error to the new project you have created just now.
Also copy layouts xml files.
now import play services you will not get this error.
I was also getting same problem.
I copied google library folder into work space and import now it's working fine.
Try to place the Google-play-service library with in your same working Directory by coping the files from Click File > Import, select Android > Existing Android Code into Work space, and browse the work space import the library project.
This is common issue Youur google-play-service-lib project and your android project should be inside the same folder For example
if your Android Appplication name is MyMap is in D:/workspace t hen your play service lib project should be in the same directory D:/workspace
Close Eclipse. Delete
.metadata
and
.recommaditions
folders from your workplace. Import your projects back.
You add Project in to your workspace.
Start Eclipse and import project one option is ther copy to workspace do it.
After that add google play services it also copy in to your work space
and add it your library hope so its working.
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
I have downloaded an android sample called custom view from android refernce from this location
http://developer.android.com/shareables/training/CustomView.zip
It only has the java files and other resources but does not contain any project file for me to import in eclipse as a project.
So when I import existing project into workspace, eclipse does not pick the project in the import dialog.
How can I import it into eclipse ? I have ADT tools installed already,
Thanks,
Ahmed
Maybe that's because you'll have to make the manifest.xml file.
What I'd suggest, is to create a new Android project, with the same package and Activity's name than in your zip (ie com.example.android.customviews and MainActivity), then copy/paste the files from your zip to the new project directory (thus replacingsrcandres` folders). That way, Eclipse will generate the manifest for you, with correct reference.
This should not take more than 30 seconds...
Go to Project Explorer and right click -> Import -> Select Android -> Existing Android Code Into Workspace -> browse to folder with your code -> finish
I encountered the same problem. I did thought that it's missing the AndroidManifest.xml file. I tried to fixed it and place it here. You can download it an try.
I want to study the sample code in android sdk which is cubelivewallpaper..
So i decided to import it. But it has a problem. i am not able to click finish because it is disabled.. here:
and here is i am trying to import.
Anyone can help me how to import sdk project wihout getting this error?
Thank you..
To import sample project follow the following steps:
Click on File ---> New ---> other, new project wizard will be opened.
Now under android option click on the "android sample project" and press next.
Select the build target e.g. android 4.1 and press next.
Now you will get list of sample projects available. Select the one you want say "CubeLiveWallpaper" and press finish. You are done
That project exists in the sample projects.(CubeLiveWallpaper)
Try Creating a sample project. No need to import it.
You shouldn't import but Create New project from exists derictory and choose this project. Good luck!
As far as I know, the SDK examples aren't Eclipse projects so you can't use the Import function. Whenever I've wanted to try any of the samples, I've created the project manually in Eclipse, and then just copied the contents (res, src and AndroidManifest.xml) from the SDK folder into the new Eclipse project.