Bummer! This is just a preview. You need to be signed in with a Basic or Pro account to view the entire video.

Start a free Basic trial
to watch this video

Sign up for Treehouse

Pulling Down GitHub Projects to Android Studio

6:02

Continuing with the GitHub tools in Android Studio, in this video we'll see how to pull a specific project from GitHub into Android Studio.


Teacher's Notes

Related Links

Video Transcript

  • 0:00

    So back in Android Studio one more things about Git through

  • 0:04

    that VCS menu we could also check out projects from Version Control.

  • 0:08

    So this if we bounce something on GitHub that we wannna

  • 0:11

    use and we wanna pull it down to our local computer, whether

  • 0:14

    we want to use it in an existing project or as a

  • 0:17

    new project, we come here to check it out on Version Control.

  • 0:22

    And again, we'll select GitHub and it's going to use

  • 0:25

    the same credentials, and because I just put in

  • 0:27

    my hub password, it doesn't ask for it again.

  • 0:32

    So, this is a list of all the repositories currently tied to

  • 0:35

    my bendog account, but we could also look for any other repositories.

  • 0:41

    So I'm gonna do, we have a little remnant

  • 0:43

    here, let's see how can we get out of there.

  • 0:46

    Maybe if I hit escape, yeah that's fine. I'm gonna look for a popular open

  • 0:51

    source library for Android called Picasso.

  • 0:53

    This is something oh, this is searching this repository.

  • 0:57

    I need to change this to all repositories and try once more.

  • 1:01

    Picasso.

  • 1:03

    This is provided by Square and this is Square has

  • 1:07

    done some awesome work for Open Source Editor development, and

  • 1:11

    they if you click on Square this is the Square

  • 1:14

    Picasso, but if you go to their home page you

  • 1:16

    can see all these different libraries that are for Android applications.

  • 1:19

    And it's just much more efficient ways to do common tasks

  • 1:25

    in the background like web connections, downloading images and some other things.

  • 1:30

    So let's go back to Picasso, and we're going

  • 1:32

    to use that clone URL that we saw before,

  • 1:37

    and now we can just paste it in here into the Git repository URL.

  • 1:41

    So, the next thing we need this is the

  • 1:43

    parent directory where it's gonna create the new folder.

  • 1:45

    This is where I typically put my source control projects.

  • 1:49

    And then you give it a name.

  • 1:50

    I'll just, I set the default.

  • 1:52

    And if you click on Clone first I'm going to click

  • 1:55

    Test just to show you it shows that it can successfully connect.

  • 1:58

    So this just makes sure that the credentials

  • 2:00

    are in place and we have everything we need.

  • 2:02

    If I

  • 2:02

    hit Clone it's going to copy everything in.

  • 2:06

    And let's see.

  • 2:08

    This is trying to import into Let's

  • 2:15

    see. Actually I'm not sure what this is asking.

  • 2:17

    This is, this is adding files to Git for, the current workshop location app.

  • 2:23

    I'm gonna click OK and see what happens.

  • 2:25

    Okay check out from Version Control. And it finds the palm.xml file.

  • 2:32

    If you haven't seen that palm.xml is a, like a

  • 2:34

    project specification file for I think it's for Bay, Baybin,

  • 2:40

    another tool for building projects.

  • 2:43

    And the Picasso is loaded here as a project.

  • 2:48

    No files are open.

  • 2:49

    If I, let's see.

  • 2:50

    I think I need to open the Project View on the left.

  • 2:54

    And then I can take a look at the Picasso source code.

  • 2:56

    Yeah, there we go.

  • 2:56

    [COUGH] And here there's a Picasso sample project.

  • 3:00

    This is all the code that's available from GitHub.

  • 3:03

    And here you can see. This is anexample

  • 3:05

    of using different modules within an Android Studio project.

  • 3:09

    So this is the Picasse library, and then there's this sample app.

  • 3:14

    And if I run this app on.

  • 3:17

    Oops, didn't mean to do that. If I run this app on Genymotion.

  • 3:24

    Which we had closed, then, we'll be able to see

  • 3:27

    the sample app and that will show us just finish

  • 3:31

    up how they pull things from Git down into our local.

  • 3:34

    Alright, so we'll give Genymotion just a moment to open up.

  • 3:38

    There it is. And, now if we run the project

  • 3:44

    actually before we do that, there is a message that popped up.

  • 3:47

    I'm not sure what it said this time but at different times the project that

  • 3:51

    you pull from GitHub, it may have

  • 3:53

    dependencies that you don't have on your computer.

  • 3:56

    So in this case earlier I had, had, I didn't have the latest, I,

  • 4:02

    I didn't have a different version of the Android SDK that was required for Picasso.

  • 4:05

    So that's because, remember we have might have multiple

  • 4:09

    versions of the Android SDK.

  • 4:11

    Android Studio has its own version so I had

  • 4:13

    to go and update the older versions of Android through

  • 4:17

    Android Studio separately from my previous Android development stuff and

  • 4:22

    once I did that I was able to use Picasso.

  • 4:25

    And that's just if you are pulling projects from GitHub.

  • 4:30

    A lot of that will be specified in the readme file or maybe

  • 4:34

    a separate installation file, things like that.

  • 4:36

    You know, details about how to use it in your own projects.

  • 4:44

    Okay do I want to run all tests?

  • 4:51

    I don't know, I don't know what this is running.

  • 4:54

    [BLANK_AUDIO]

  • 4:57

    There's run configurations up here.

  • 5:00

    And this is, this is, I haven't used this Picasso sample app, I just have

  • 5:05

    used the library so not sure exactly, just playing around and seeing if this works.

  • 5:12

    Even if it doesn't work, what were trying to show here is just how to run an

  • 5:16

    app, so this is actually starting its own

  • 5:17

    emulator, it didn't tie in Genymotion, for whatever reason.

  • 5:20

    So, I'm just gonna close this and we'll, we'll forget about that, because the

  • 5:22

    important part here was just seeing how to take code from GetHub, and pull it down.

  • 5:27

    This is pulled into a directory.

  • 5:29

    We saw, we, we had specified it was gonna go in the development folder

  • 5:32

    and here you can see Picasso has all the files that were available on GitHub.

  • 5:37

    So these three tools can really make your life

  • 5:39

    as an Android developer a lot easier and more rewarding.

  • 5:43

    Android Studio can be used for the development process, for writing the code.

  • 5:46

    Genymotion is a fantastic

  • 5:48

    emulator that you can use instead of the regular emulator.

  • 5:51

    And in some cases it's as good as or even better than an actual device.

  • 5:55

    And finally, using Git to manage your projects is a skill

  • 5:58

    that every developer should have in his or her tool belt.

Show full transcript

Workspace

You have to sign up for Treehouse in order to create workspaces.

Sign up

Downloads

You have to sign up for Treehouse in order to download course videos.

Sign up

Instructor

  • Ben Jakuben

    Ben is a father, husband, son, friend, and teacher. He is firmly committed to the belief that the world is evolving to a better place. Find him on Twitter @benjakuben.