Skip to content

Push Your First Android Game

Joe Williams edited this page Jun 2, 2015 · 3 revisions

First, you'll want to grab a copy of the flappy bird clone that you'll be using for this exercise. All of this code is hosted on GitHub at https://github.com/MissionBit/theplanethatcouldntflygood. We'll use git to clone the repository and get a local copy of the files.

In order to do this, you'll need to open the Terminal app on your computer. You can search for it using Spotlight, the magnifying glass at the top right corner of your screen. We'll discuss the terminal in depth later, but for now, just copy and paste the following lines one by one into the terminal, hitting enter after each one:
mkdir projects
cd projects
git clone git://github.com/MissionBit/theplanethatcouldntflygood.git - when you are prompted about connecting, type 'yes' and hit enter.

This will

  1. create a new folder in your home directory called "projects"
  2. move into the folder "projects"
  3. pull a copy of the code from theplanethatcouldntflygood repository on GitHub.

After completing these steps, you're ready to fire up Android Studio, the integrated development environment (IDE) which packs a text editor and a bunch of useful development tools. You can find this by using Spotlight again.

When you first start Android Studio, you'll be prompted to complete the installation. Select the "I do not have a previous version of Android Studio" option and you should be greeted with a "Welcome to Android Studio" screen. Select "Import Project", navigate to your projects folder, select "theplanethatcouldntflygood" folder and start the import. After a bit, you should see the project pop up in a window like this: Android Studio window

Now you can plug your android phone into your laptop - remember when you turn the phone on to press the back button at the activation screen so that you don't activate the phone and start getting charged. After plugging it in, you'll see an "Allow USB debugging" prompt on the phone screen. Check the "Always allow from this computer" box and then tap OK.

Now you can start to compile the Android app by pushing the green triangle button on the top bar. There will be a "Choose Device" prompt that pops up, so check the "Use same device for future launches" box and hit OK. If everything went well, the game should pop up onto your phone screen. Congratulations you just pushed your first Android game! 👍

For those who are curious, you can explore the code in Android Studio by opening the theplanethatcouldntflygood/core/src/com.badlogicgames.plane/PlaneGame.java file - its only 237 lines! Don't worry if none of this code makes sense yet, we'll be going over all of this very soon!

Once you finish this, you can move on to the Git setup section.