ZhouningMan
ZhouningMan

Reputation: 77

Android studio how to build a project from github source

How do I build a android studio project from github repository that only contains the source codes, no gradle build information. For example. I want to build a project from this repository https://github.com/googledrive/android-quickstart, but the android project could not be built correctly. Can I just add the build.gradle and expect the project to work?

Upvotes: 2

Views: 3368

Answers (3)

Kevin Crain
Kevin Crain

Reputation: 1935

There are three ways to do this that I know of officially.

1) Add project directly

Step 1:

Add project into following directory {App Root Folder}/Libraries/ (create libraries folder if doesn't exist)

Step 2:

Go to File/Project Structure/ under Dependencies tab click green add icon and select Module dependency and select the project you added to libraries.

2) Add project as a .jar/.aar

Step 1:

Either look for a the version of .jar/.aar you are looking for on web or compile project to .jar/.aar.

Step 2:

Follow Step one for previous way but instead select Library dependency

3) Add project from Maven

Step 1:

Find library on gradleplease.appspot.com

Step 2:

Add compile 'package name' under dependencies in your apps build.gradle

Upvotes: 1

Kristy Welsh
Kristy Welsh

Reputation: 8392

This is a project in eclipse. Just download the zip file, and extract it. Then in android studio, import the existing Eclipse project by hitting File -> Import Project. Android Studio will just build you a AS project, including all the gradle files.

Upvotes: 3

ksarmalkar
ksarmalkar

Reputation: 1894

You can just create a new project with same package name as in the github project.

This will create a compilable android project/library. after that manually copy the code by downloading from github (download as zip) and then just copy the source folder.

Upvotes: 1

Related Questions