I've got a long history with Eclipse, but I wanted to try Android Studio. So I created new project and now I want to add SlidingMenu library to it. I found some tutorials whose say to go to Project structure, click plus button and select Import module.
But there is no Import module option, when I click plus then New Module window pops up. I'm currenty using Android studio v0.3.6. Is now proccess to import module different?
Thanks
The Import Module feature has been removed for Gradle-based projects because it previously didn't do the right thing with your Gradle build files and it would put your project in a confusing state; it will be re-enabled when it's properly implemented. The bug tracking it is at https://code.google.com/p/android/issues/detail?id=62122.
In the meantime, to add a module, you need to write a build.gradle file for it by hand, add a reference to the module to your settings.gradle file, and if the project is still open in Android Studio after you make the changes, click on the "Sync Project with Gradle Files" button in the toolbar.
If you're not familiar with Gradle, you can get docs on the particulars of Android Gradle projects at http://tools.android.com/tech-docs/new-build-system/user-guide.
Related
How to solve it when I import eclipse project into my android studio
Image to understand issue
Edit 1:
Import Eclipse Project to Android Studio:
Start Android Studio and close any open Android Studio projects.
From the Android Studio menu click File > New > Import Project.
Alternatively, from the Welcome screen, click Import project (Eclipse ADT, Gradle, etc.).
Select the Eclipse ADT project folder with the AndroidManifest.xml file and click Ok.
Select the destination folder and click Next.
Select the import options and click Finish.
The import process prompts you to migrate any library and project dependencies to Android Studio, and add the dependency declarations to the build.gradle file.
For detail description try this link
https://developer.android.com/studio/intro/migrate.html#migrating_from_eclipse
Edit2:
Well, there might be another way of solving this problem, but I ended up removing the line in the project.properties file that was making reference to the Android Bootstrap library.
No matter what projects I import they never work - Android Studio is always flagging this is not a Gradle build project.
I select VCS -> GIT and clone the repo without any problem. I then go through the wizard with no issues (I select create project from existing sources), creating my code base with a warning, below. When i try to run throws all sorts of errors.
Migrate Project to Gradle? This project does not use the Gradle build
system. We recommend that you migrate to using the Gradle build
system. More Information about migrating to Gradle.
Don't show this message again.
When I go to the link it makes no sense whatever to me, it says to create an arbitrary Gradle file and populate it with my references (I think), which is out of my understanding. I shouldnt have to do this as it says in the repository instructions that it is in fact a Gradle-based project.
The project I am trying to clone is
https://github.com/googlesamples/android-play-location.git
Can anybody tell me specifically how to import and run the following git repo in Android studio for example?
Ok from the start (as i dont know what other way works)
Go to Git master page (it has 'download to zip' or 'clone to desktop' button). use https://github.com/googlesamples/android-play-location as a test master page if you like to ensure you have no other issues i did not.
Click 'download zip'
Unzip the project
Close the current project in Android Studio -> File/Close Projects
A popup screen like this will appear, choose Import Project (Eclipse ADT, Gradle etc.)
You will be asked to select the project, select your unzipped project within the master folder, eg basicLocation
Select 'create project from existing resources' default
dont change project name (may cause issues)
Next through 'import project -> directories'
Next through project -> libraries
Next Through import projects -> modules and module dependencies
Next through import project ->SDK
Next through import project ->manifest.xmls
Android Studio starts. Ensure the configurations dropdown has a project in it called 'app' app
Select 'sync Gradle' icon (green circle)
May get language warning, ignore or accept restart, doesnt matter
At bottom it should now say 'Gradle executing tasks' after which it will run on device or emulator :)
Short answer: File > Open > the build.gradle file you just cloned with the repo
I just wanted to add this, because I had the same problem, and even if Fearghal´s answer and comments pointed me in the right direction, I think he may have added unnecesary extra steps, i.e. Download as ZIP, Close current project, etc.
Simply put, you VCS > Git Clone, and then open the build.gradle file. That´s it
This can happen for many reasons. I typically see it when I move the directory. The easiest way I have found is to close the project and then reopen it using "Import project (Gradle, Eclipse, ADT, etc.) menu item then selecting the folder. This will force it to reimport the project and fix any metadata/configs.
What worked for me was
On Android Studio
Open the settings.gradle file
include your project
include ':myproject'
Well, as Android Studio correctly says, https://github.com/googlesamples/android-play-location is not a Gradle project.
Any subdirectory of that repository is however.
They are different projects.
So clone that repository and import one of its subdirectory in Gradle.
OK I know people have asked this problem thousands times, but Android studio is so so so hard to understand and use and I still can't find the correct way.
I find several solutions, but all of them says to copy the library codes into main project. It makes no sense to me. When I try to build a standalone project for the library, I find no "New project from existing source" like that in Eclipse.
Can I have a step-to-step for:
I have a main Android Studio project
I have an Eclipse Android library project
Without making a copy of library project
I can let the main project "use" library project
The point is, if I have many app projects using the same library source, I can just modify one copy. If I need to put library codes in every app project, it's a disaster. Eclipse can do this without any problem.
Thank you. I'm really exhausted with Android Studio, but I can't choose to stay on Eclipse since Google says ADT won't be supported anymore.
The real answer to keep your library project only in one place is in this post :
Android Studio 0.8.1 Creating Modules without copying files?
In Android Studio Project import your eclipse library project as new module. Then in Android studio right click on your app module go to module setting > select dependency tab > click plus> select module dependency > select library project module.
new Module or import Module under the project,
then open Module Settings--》Module dependencies --》‘+’ module dependencie.
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.
I was just trying importing the action sherlock library to my project in android studio. Once I imported the project it shows to find the gradle path:
Really can't figure out what it means? Does it want build.gradle from the action sherlock project? If so tried that too, the build.gradle does not appear in the chooser window.
But it's there when we try in the file explorer.
Do we have any way around?
The best way to import ActionBarSherlock is to use it via a Maven coordinate-style include rather than downloading the source and trying to import it as a module. In Project settings, select your module, and from the Dependencies tab, click the + button, choose "Library dependency":
. From the dialog that follows, enter the Maven coordinates com.actionbarsherlock:actionbarsherlock:4.4.0#aar
In a more direct answer to your original question, it was asking for the path to your Gradle installation, not the build file. If you want to import modules from source, it's best to update Android Studio -- there have been fixes that went in since 0.5.2 which you're running. In the most recent versions, you can choose "Import Module" from the File menu to import modules from source.