I have and android studio project that I have checked into git. My git ignore file looks like:
# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated files
bin/
gen/
# Local configuration file (sdk path, etc)
local.properties
# Eclipse project files
.classpath
.project
# Proguard folder generated by Eclipse
proguard/
# Intellij project files
*.iws
.idea/workspace.xml
.idea/tasks.xml
/gradle
When I go to my laptop to pull the project down I am not sure whether I should do open or import inside android studio to correctly being in the project. When I do open I get the following error:
Cannot load module file 'D:\dev\android\projects\projectname\ProjectName.iml':
File D:\dev\android\projects\projectname\ProjectName.iml does not exist
Even though that file does exist.
When I do import instead of open android studio asks for the path to gradle home and I am not sure what to put in. I am using android studio 0.4.3.
Any help would be really appreciated.
Answer:
I was able to get the project to build by doing open instead of import. However in the process intellij created an additional iml file at the root of my project which doesn't exist on my desktop. Not sure why it was created and if I need it. Can't for the life of me figure out the proper way to push my project into git and then restore it on another machine without causing lots of new files to be generated and break things.
You can directly import GitHub projects into Android Studio. File -> New -> Project from Version Control -> GitHub. Then enter your GitHub username and password. Select the repository and hit clone.
Launch Android Studio, and click File > New > Import Project. Locate your project directory, click the build. gradle file you created above to select it, and then click OK to import your project.
On github web, go to the repo you want yo clone and click on the download button (code) then copy the url where it says clone with https. In Android Studio 4.0, go to VCS (if you've added a github plugin) then click on Get From Version Control, it will load a window where you'll paste in the url you got from github.
Use import and delete "/gradle" out of your .gitignore Its ok to ignore .gradle, but /gradle should be included in the git.
At least this is the way i got it working for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With