Android Studio can create a new GitHub repository and upload your project for sharing with a few clicks. In this video, learn how to create public or private repos and explore them on GitHub's website.
- [Instructor] Android Studio has complete integration with Git and the use of GitHub to store your code repositories. This chapter has been completely redone with the introduction of Android Studio 4.1, because there are changes to the user interface when you're working with Git and GitHub. The first step in working with Git and GitHub is to set up a GitHub account. You can go to GitHub.com and click sign in. GitHub accounts are completely free and you can store both public and private repositories. Follow through the process of creating the GitHub account and then come back to Android Studio and go into Android Studios preferences or settings. Under version control, go to GitHub and set up an account. Now on my computer, I've already set up the account so I'm going to verify that I want to use my existing credentials and show that I've already created the account here. If you're doing this from scratch, you can click the plus icon, add your login and your password, and then log in. If you set up two factor authentication, say with an authenticator app on your cell phone, you'll be able to use that right here from within Android Studio. Now, once you've created the account and integrated it into Android Studio, uploading an application as a GitHub repository takes just a couple of steps. With the application open, go to the menu and choose VCs, import into version control, share project on GitHub. Android Studio will verify that you're authenticated, and then it'll ask you for the repository name. The repository name can't have any spaces. So I'm going to eliminate these space characters, and then if you like you can indicate that the repository is going to be private. I'm going to keep it public for now. The remote value can be left as origin and the description can be anything you like. I'll leave that blank, and I'll click share. After a moment this dialogue pops up asking me to commit my changes. With Git, every commit that is every time you save your changes you have to add a commit message. And this is where you place it. When you create a brand new repository in Android Studio the default messages initial commit. I'll accept that message and click add. And down at the bottom of the screen I see a message indicating that these files are being pushed up to the GitHub repository. When that operation is complete, I see this link, I'll click it and that opens my repository. Because I didn't say I wanted it to be private this repository is now visible to everybody. If I want to change it and make it a private repository, I'd have to sign in with the same account and then go into the settings and you can change it there. Back in Android Studio, now that this application has a Git repository associated with it, a new tablet appears at the bottom labeled Git. And you'll see that there's a keyboard shortcut associated with it. In Android Studio 4.1, you'll see the Git tab appear in earlier versions, you'll see a version control tab. In 4.1, when you click on Git, in the console you'll see everything that's happened from the command line in response to what you asked for from the Android Studio user interface. So now that you have your project uploaded as a GitHub repository, you can start making changes and you can commit those changes or roll them back, or do all the other things that are possible with Git.
- Installing Android Studio on macOS and Windows
- Creating your first project
- Creating virtual devices for testing
- Version control with GitHub
- Customizing the Android Studio interface
- Managing dependencies
- Generating and editing Kotlin code
- Refactoring and inspecting code
- Using templates
- Analyzing and debugging code
- Managing bitmap and vector images