How do you clone a Github project in the same project?

advertisements

In android studio how do you git clone a project from github into the same project?


If I got your question correctly, you want to check out some library and add it as a dependency to your (gradle based?) project. The prefered way would be to checkout it separately and built it as a library project. And if you have maven you can then install it to your local repository.

The other way (and probably what are you trying to achieve) is to add it as a submodule of your local repository.

git submodule add git://repourl.git yourSubmoduleFolder

Then you can add this library as a module dependency to your application module. (You don't have to use git submodules, you can always just get the repo as a zip and extract it into your project)

If you put your library under libraries folder in your project then you can do it like this.

  1. Add this to your settings.gradle

    include ':libraries:yourLibraryModuleName'

  2. Add this to your build.gradle

    dependencies {
        compile project(':libraries:yourLibraryModuleName')
    }
    
    
  3. You should now be able to build your application with the submodule

Please note that this was just a quick answer, you can find more info on both gradle submodules and gradle module dependencies here on StackOverflow. I guess this should be enough to point you in a right direction.