Join David Gassner for an in-depth discussion in this video Importing the sample app into Android Studio, part of Android App Development: Distributing Android Apps (2015).
- You can follow along with the exercises in this course either with your own Android Studio Project, either a new project you create from the Android Studio welcome screen, or a project you've been working on yourself or you can use the beginning application that I include in the Exercise Files, PlainOlNotes2. I describe how I built this app in the Lynda.com course, "Building a Note Taking App for Android." This is an Android Studio Project. You can import it directly from here or, as I'm going to show, you can check it out from a GitHub repository.
If you're working on Windows you'll need to make sure you've installed Git before following these steps. It's available at git-scm.com/download/win. From the homepage of the repository go to the clone URL and copy it to the clipboard by clicking that icon. That's the information you need to provide to Android Studio to check out the project. Then in the Android Studio welcome screen, click "Check out Project from Version Control," and choose GitHub.
If you've previously used this feature you might be prompted for a master password. If so, enter it. If not, you'll go directly to the GitHub login screen. If you don't already have a GitHub account you'll need to set one up. Click the Sign Up link and that'll take you to the GitHub homepage where you can create an account and set your credentials all for free. Then return to the login screen and enter your credentials.
Then paste in the clone URL, then choose the Parent Directory where you want to download the project. I've chosen the default of "AndroidStudioProjects," under my Home Directory and confirm that you want to name the directory the same as the project itself, PlainOlNotes. Then click the Clone button and that will download the project to your hard disk. When prompted to open the new project, click Yes and the new project will be opened in Android Studio.
If you see this error, "Unregistered VCS root detected," click Add Root, and that will synchronize your project with the Android Studio Project on GitHub. When the project is downloaded and opened, Android Studio will try to build it. If you have the right components it should succeed, but if not you might need to download some STK components. Let's take a look at the components that this project is dependent on. I'll go the Project tab which in Android Studio 1.2 appears here as the second tab from the top.
I'll go to Gradle Scripts and I'll open the build.gradle file from the app module. This project was created with STK version 22, that's Android 5.1, and Build Tools version 22.0.1. If you don't have those components you should download them. Go to Tools, Android, STK Manager and make sure that you have the right version of the Build Tools, again 22.0.1, and the right version of the STK platform 22.
You'll also need the right support library. That's 22.1.1 and you can check that down at the bottom under Extras. If needed, you can update the Android support library from here. After you've downloaded everything, you can come back here and then rebuild your project. To test the project you can connect the physical device or open a virtual device. Click the Run button on the Toolbar, That will cause the application to be completely rebuilt and after a few moments I'll be prompted for a device to run on.
I'll choose my emulator and then after a few moments, the app is open. You can try the app out by clicking on the Options menu and choosing Create Sample Data and that'll create a few notes. Then you can click the plus floating action button and enter a new note and then touch or click the back button and see that the new note was created. You can then open that note and delete it. That'll take you back to the Lists screen, then once again going to the Options menu, you can Delete All Notes, and confirm and the database will be empty.
- Packaging an Android app
- Distributing through Google vs. Amazon and other app stores
- Generating a signed APK file
- Testing the app
- Protecting an app with ProGuard
- Registering and publishing apps with Google Play
- Adding in-app products
- Tracking app usage and revenue in Google Play
- Submitting an app to Amazon