• $10 Game Dev' Courses - Use code "BREAKTHRU"

    Video courses

Unity Pro Development A to Z – Build 10 Android/iOS Games

The Complete Android & Java Developer Course – Build 21 Apps

The Complete Java Developer Course. Learn Step by Step

Setting up your Android development environment does not have to be hard. In this tutorial, I will walk you through all the steps required to install Android Studio 2.2.2. By the end of the tutorial, you will be ready to build and deploy your first Android games and I have written quick tutorials on how to build and how to deploy for the first time.

  • Learning java by building Android games

    Learning Java by Building Android Games

    Want to learn Java for Android? Even if you are completely new to either Java, Android, or game programming but are aiming to publish Android games, then this book is for you. This book also acts as a refresher for those who already have experience in Java on other platforms or other object-oriented languages.
    • Setup your own Android game programming environment using Android Studio
    • Control logic, branch your code, and add real decision-making depth to your games
    • Design and use 2d sprite animations, smooth pixel graphics, sound FX, simple collision detection and artificial intelligence (AI)
    • Build around a dozen sample test apps and 4 complete working games!
    Amazon USA
    Amazon UK
    Amazon CA
    Our Store (US only)
    small_book

    Android Game Programming by Example

    Learn to build exciting Android game projects. Build a simple flappy-bird like game to a multi-environment, tough, retro platformer then an OpenGL ES 2 Asteroids clone, running at hundreds of frames per second .
    • Animate your characters with sprite sheets, add multiple scrolling parallax backgrounds, and implement genuinely tough, playable levels in your games
    • Every single line of code is printed in the book! No need to refer to the code files while trying to follow along. All the code files are also supplied separately so you can refer to them in their completed form and copy/paste them into your project if you like.
    • Implement a multitude of other game features such as pickups, firing weapons, HUD’s, generating and playing sound FX, scenery, level transition, high scores, and more
    Amazon USA
    Amazon UK
    Amazon CA
    Our Store (US Only)

About this project

Skill level 1
Time to complete 20 minutes (downloads might take longer)

New concepts

  1. Installing the JDK (Java Development Kit)
  2. Installing the Android Studio 2.2.2

Recommended preparation tutorials

Assumed previous experience

  • None

The first step is to install the Java Development Kit (JDK). The JDK is what facilitates our programming in Java. As the vast majority of Android programming is done in Java, this is a vital step. We will then install Android Studio which will use the JDK behind the scenes. At this stage, we can start building games for Android.

Installing the Java Development Kit(JDK)

Go to the download page for the JDK.  Click on the Download button under the JDK option.
download-jdk-button
Check the Accept License Agreement checkbox and then click on the download that matches your operating system.

accept-license-agreement
This tutorial is specifically for Windows and the screen images are from Windows 10 but the instructions should be very easily interpreted for earlier versions of Windows and not too much trouble for experienced Mac and Linux users. Mac and Linux users can find JDK install instructions specifically for them below.

Installing the JDK on Linux
Installing the JDK on Mac

Once your download is completed, run the .exe file that you just downloaded. As with most software installations on Windows, You will need to give permission to run the file. Now we can step through some simple choices to get the JDK installed. For the first option, simply click Next.
install-jdk-first-window
The details of the next step are shown in the image below. I suggest leaving all the options at their defaults if possible. The only thing you might want to change is the default install location if the suggested hard drive is nearly full. If you do change this and get problems later on, look at the troubleshooting section at the end of the tutorial.

install-jdk-options
The setup process will get busy for a little while and then you will be asked where you want to install the JRE as shown next.

where-to-install-jre

This is the regular part of Java which is used to run Java programs on your PC. I would suggest installing it in the same place you chose for the JDK. So if you didn’t change anything in the last step, just click Next.

In the final part of the JDK installation, you can click Close. It is not necessary to read the Next Steps option. they are nothing to do with Android game development.

Now we can setup the latest version of Android Studio.

Downloading Android Studio

As mentioned at the start of this tutorial, Android Studio is where all the actual game programming will take place. Most Android coding uses the Java language and this is the reason we installed the JDK first.

To get started installing Android Studio 2.2.2, visit the download page and click the Download Android Studio button, accept the terms and conditions and accept the file download.

download-android-studio-2_2_2

If the latest version has changed at the time you are reading this then go with the latest version. You should find that these instructions are still viable as the process hasn’t changed much even since the early days of Android Studio. The download might take a few minutes or perhaps a bit longer depend on the speed of your Internet connection. The file is about 1.6 gigabytes.

Installing & configuring Android Studio 2.2

Once the file is downloaded run it and follow these simple steps to configure it. On the first window click Next.

android-studio-install-first-window

On the next window leave the default options to choose to install Android Software Development Kit (SDK) along with a Virtual Device in which we can test games. Actually, I will show you how to test your games on a real device but the Virtual Device can still be useful.

install-android-sdk-and-virtual-device

In the window that follows you just need to agree to the license.

In the Configuration Settings window that follows next, you can leave everything at the default to let Android Studio decide where to install itself. Look carefully, however, at the disk space required. It is quite significant (nearly 4GB).  If you change locations, make a note of the exact locations that you choose and refer to the troubleshooting section at the end if something doesn’t work later.

On the final screen before the main installation is performed click Install. Android Studio will be busy for some time now preparing itself.

When the installation is complete, click Next, then Finish. If this is the first time you have ever installed Android Studio choose I do not have a previous version of Studio or I do not want to import my settings from the popup dialog box and click OK.

Configuring the Android SDK

We are in the very final stages now. When you are greeted with this next window, click Next.

android-studio-configure-sdk

In the Install Type window that follows choose Standard and click Next. This allows Android Studio determine the best versions of various final components to download and install. Click Finish.

android-studio-verify-settings

After a wait, while more files are downloaded and installed, click Finish. And this time you really are finished! Maybe.

If everything has gone well you will now be faced with the Android Studio start screen where you can begin to make games. If you see the image below, move on to the tutorial Building your first Android game. If not, don’t panic and read on.

android-studio-start-screen

Troubleshooting

If you have any trouble at all, perhaps Android Studio start screen doesn’t appear or you get one of the several possible errors that mention “the path to the JDK” then you need to take one more step.

We need to make sure that Windows and Android Studio know where to find the JDK. Right-click on your My Computer icon (This PC on Windows 8, on Windows 10 you can search for Edit the and click on Edit System Environment Variables).

Navigate to Properties | Advanced system settings | Environment variables | New (under System variables, NOT under User variables). Now you can see the New System Variable dialog box.

new-system-variable-dialog-box

As you can see in the previous image, type JAVA_HOME, for the Variable name field. In the Variable value: field, enter the folder/file path you made a note of when installing the JDK. The image above shows what you need to put if you installed to D:\Program Files\Java\jdk1.8.0_05. Your exact file path will have a different ending to match the latest version of Java at the time you downloaded it and the location you chose.

Click on OK to save your new settings. Now click on OK again to clear the Advanced system settings dialog box.

You are now ready to start programming games for Android using Android Studio. Move on to the tutorial Building your first Android game.

Please visit the Android category of our game coding bookstore for beginners