Import Android Studio project from git into Android Studio (Gradle)

I’ve been reading this for hours now and everyone seems to have a different approach or that the tutorials are out of date.

Android Studio .gitignore only includes the app directory, this is on purpose. For what reason I do not know. When trying to clone the git repo Android Studio does not know how to handle it. A very annoying flaw in Android Studio.

  • Build gradle in jenkins failed to find Build Tools revision 21.1.1
  • Android+Eclipse project sharing via SVN?
  • Build Unity project with Jenkins failed
  • Error running git“Cannot run program ”git": error=2
  • failed to create task or type checkenv Cause The name is undefined
  • best way of setting up a phonegap multiplatform project repository
  • What should be in my .gitignore for an Android Studio project?

    I have a remote git repo containing the project in the form:

    enter image description here

    as you can see the git repo contains the /app directory.

    I then try to import it via Check out project from Version Control and select git:

    enter image description here

    Everything works, the Test is successful and then I click on Clone:

    enter image description here

    The next part I press Yes as git did not clone the entire project but just the essential source files:

    enter image description here

    This is the part where I am lost, I am guessing I am to create the project via Gradle, so I select Gradle and press Next:

    enter image description here

    What am I supposed to do here, there are apparently gradle files on the net but which one am I supposed to use:

    enter image description here

    Create project from existing sources

    If I choose Create project from existing sources I get the following problem:

    enter image description here

    enter image description here

    enter image description here

    Results in this, I was expecting app directory:

    enter image description here

    File structure (as you can see fela is missing a lot of files, this is when I chose create project from existing sources, MyApplication is an example of an app which was created in Android Studio):

    enter image description here

  • How to revert a commit and create a new branch from those changes?
  • gits error on push Empty reply from server
  • Does GIT STASH persist even after a computer shutdown?
  • Handling file renames in git
  • git shallow clone (clone --depth) misses remote branches
  • git: put a branch in a subdirectory
  • 3 Solutions collect form web for “Import Android Studio project from git into Android Studio (Gradle)”

    The answer is obvious when looking at the .gitignore file of a newly created project. The build.gradle file IS and SHOULD be included in the push to the remote repo.

    So the person who made the repo in my question is doing it wrong. The .gitignore file includes:

    .gradle
    /local.properties
    /.idea/workspace.xml
    /.idea/libraries
    .DS_Store
    /build
    /captures
    

    As seen, more files should of been uploaded to the remote repo.

    Choose Existing Sources instead of Import

    IF your project is showing error like The project 'xxxxxxx-xx' is not a Gradle-based project then check this link. I hope it helps. This link might cover your possible problem. Let me know the progress.

    Git Baby is a git and github fan, let's start git clone.