This course is accompanied by exercise files that you can use to follow along with the demonstrations on screen. I've copied the exercise files to my desktop, but you can place them anywhere on your hard disk. The exercise files are organized by chapter. Within each directory you'll find sub-directories for each video, and within those you'll find directories that are organized as Android Studio projects.
- [Instructor] This course is accompanied by Exercise Files that you can use to follow along as I build a game app for Android devices. I've copied the Exercise Files to my desktop, but you can place them anywhere on your hard disk. The Exercise Files are organized by chapter, with one subdirectory for each chapter that has exercises. There are three of those chapters, chapters three, four and five, and within each of those directories, you'll find subdirectories that each contain an Android Studio project.
You can recognize the project by its contents. There will be an app directory. That's the application module. A gradle directory, and a number of standard files. There will be an IML file that matches the name of the project. I built these applications using Android Studio 2.2 Preview 6. You're most likely going to be using a later version of Android Studio, so I'll show you how to update the files when you open each project. To open a project, select Open an existing Android Studio project from the welcome screen.
Then start at your Desktop. On Mac, you can press Command + D, and on Windows, Control + D, to jump to your Desktop directory. Then open the Exercise Files, go to a chapter directory, go to a video subdirectory, and then select the directory that has the Android Studio icon. Then, you should be able to open the project. The first time you open any of these projects, it might take a few minutes while Android Studio downloads certain components that it needs for all of them.
After that though, opening a project should go pretty quickly. To see the project's contents, I'll go to the Project window, then I'll switch to a different scope. I'll choose Project, and then I'll open up the project directory. Within the Project directory, there's a build.gradle file. I'll open that and show that there's a classpath setting that's referring to a particular version of the gradle plugin. Now again, I built these projects using Android Studio 2.2 Preview 6, and so my gradle plugin matches that.
I'm using 2.2.0-alpha6. If I were instead using the first beta version, I would change that to beta1. You must match this classpath setting to your version of Android Studio. I'll undo that change, so that my gradle file is correct. In the app directory, you'll find another build.gradle file. This is the build file for the application. You'll see that these projects are built targeting SDK version 24. That's the first release of Android 7 Nougat, and the minimum SDK version is set to 19.
Again, there might be other changes that you need to make for your particular version of Android Studio. For example, you might have to change the version of your appcompat library. That's the support library. I'm using 24.1.1, but you might see an error indicator indicating that there's a more recent version. If so, follow the prompts and make the updates as needed. After making any changes to your gradle files, click Sync Now, and that should rebuild the project using the new settings.
You should then be able to run the application either on a virtual device running in the Android Emulator, or on a physical device that you've configured with USB debugging and connected to your development computer. The Exercise Files directory also contains some other subdirectories. There's an Assets directory that has a couple of graphic files. One named balloon.png and one named modern_background.png, and then a couple of xml files. These are Android vector drawable files, and they'll be used to create other images in the application.
There's also an audio subdirectory that has a couple of audio files, a wav file that makes a balloon pop, and an mp3 files that has a bit of longer music, and I'll be using all of these assets during the course. Also in the Exercise Files directory, there's a Software directory, and it has a jar file called the Final Android Resizer. This is a little Java-based application that I use to create multiple versions of my graphic files. The Solutions directory contains finished versions of each of the exercises.
You can either follow along in all of the coding steps that I'll show you, or you can go directly to the Solutions directory, and you can look at the finished versions for each exercise. This course will move fairly quickly. I'm going to be describing a lot of different techniques in close succession. If at any point it goes too fast, just take a moment and rewind the video and watch that section of the video again. Again, you can always use the Solutions versions of the exercises to see how the final version turned out.
- Working with Java vs. C++
- Creating a new Android project
- Defining the visuals: background, menus, and animation
- Defining and managing levels
- Displaying scores
- Managing limited gaming resources
- Completing the game logic
- Adding audio effects