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.
Check the Accept License Agreement checkbox and then click on the download that matches your operating system.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.