Learning Android Game Development

By Nikhil Malankar
  • Instant online access to over 7,500+ books and videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies

About this book

In this book, we’ll start with installing Android studio and its components, and setting it up ready for Android N. We teach you how to take inputs from users, create images and interact with them, and work with sprites to create animations. You’ll then explore the various collision detection methods and use sprites to create an explosion. Moving on, you’ll go through the process of UI creation and see how to create buttons as well as display the score and other parameters on screen.

By the end of the book, you will have a working example and an understanding of a 2D platform game like Super Mario and know how to convert your 2D games to 3D games.

Publication date:
May 2017


Chapter 1. Introduction to Android N and Installation of Android SDK

Welcome to the world of Android and game development. You are about to begin a journey that will set up a foundation for you to get started with converting your wildest imaginations into games. This book will be your stepping stone to creating amazing games. If you are a complete newbie, you will go through a steep yet comfortable learning curve, and, by the end of this book, you will have created your own game.This book's chapters have been divided into extremely easy-to-understand parts, which require no prior experience in game development. Experience in programming, however, is a must.This chapter will guide you through an introduction to Android N along with steps for installation of required software. In short, you will be learning the following in this chapter:

  • Short introduction to Android N
  • Introduction to game development with a few examples of games that are doing well
  • Installation of Android Studio
  • Components of Android Studio and setting up for Android N
  • Quick introduction to some basic concepts in Android

Introduction to Android N

It all started way back in 2005 when Google acquired a new company, which would later change the course of mobile computing for good. Yes, you guessed it right! The company that was acquired was the developer of the Android operating system. Since then, Android has seen a lot of developments and has grown significantly in terms of its user base because of the might of Google. At the time of writing this book, Android N is the latest version of this OS. Market share of Android has been growing ever since and is currently at 87.6% of total mobile computing devices. This is huge, and therefore, from a developer perspective, it is extremely important to develop for this platform because most of the mobile base are Android users.

Android N stands for Android Nougat. You must be aware of the naming convention for Android versions. If you are not, they are named in an incremented alphabetical fashion and each version is named after a sweet, barring the exception of the first two versions. Here’s a quick look at the different versions of Android:

  • Alpha
  • Beta
  • Cupcake
  • Donut
  • Eclair
  • Froyo
  • Gingerbread
  • Honeycomb
  • Ice Cream Sandwich
  • Jellybean
  • Kit Kat
  • Lollipop
  • Marshmallow
  • Nougat


You can read more about the history of android from the official source at https://www.android.com/history/.

The world of app development is interesting-but even more interesting than that is, one specific field, that is, game development. Mobile games account for the highest number of downloads on the Google Play Store, and, therefore, this is a most exciting time for game developers since Google has established a massive distribution channel and has made it extremely easy for mobile game developers to publish their games. Gone are the days when you’d have to wait for months or even years to crack a publishing deal with a major publisher. In today's times, you can simply sign up on Google Play Store as a developer and in a matter of hours publish your first game, if it is ready, and get feedback from live users.

The world of Android games has seen massive success stories, such as Angry Birds, Candy Crush, Subway Surfers, and so on. Even games with simple gameplay, such as Flappy Bird, have done extremely well, and it was estimated that at the game’s peak it was earning around $50,000 per day in ad revenues. Isn’t that exciting? You are just one click away from getting your game to a potential audience of billions, and, if your game gets noticed, then you’ll be having the time of your life.

You can make a game as simple as a text-based game or as complex as a third-person shooter. You are only as restricted as your imagination. Plus, all the resources you need are available easily today online. This book will serve you as a ready reference to get started in the world of Android game development and will use the latest version of Android, so you are up-to-date with your knowledge. You don’t necessarily need to have prior experience of developing games for Android platform; however, if you do, then that would be a plus. You do need to have a little bit of Java programming experience, though, to get started. However, rest assured that this book’s language is going to be as easy to understand as possible, and in the whole process of developing your first game for Android, you will have a lot of fun.

So, without further ado, let’s dive right into this exciting journey of developing games for Android using the latest components and tools available at our disposal. I hope you have a great time reading and implementing simultaneously from this book and would highly recommend that you make your own notes while going through this book.


Software requirements

To start our journey into game development for Android, we will need certain software installed on your computer. We will use the latest version of Android Studio, as of this writing, to get started. This chapter will guide you through the installation process.

Before you start your installation, make sure that your computer meets the following system requirements:

  • Windows:
    • Microsoft® Windows® 7/8/10
    • 3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android Emulator
    • 2 GB of available disk space minimum, 4 GB recommended (500 MB for IDE + 1.5 GB for Android SDK and emulator system image)
    • 1280 x 800 minimum screen resolution
    • For accelerated emulator, 64-bit operating system and Intel® processor with support for Intel® VT-x, Intel® EM64T (Intel® 64), and Execute Disable (XD) Bit functionality
  • Mac:
    • Mac® OS X® 10.10 (Yosemite) or higher, up to 10.12 (macOS Sierra)
    • 3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android Emulator
    • 2 GB of available disk space minimum, 4 GB recommended (500 MB for IDE + 1.5 GB for Android SDK and emulator system image)
    • 1280 x 800 minimum screen resolution
  • Linux:
    • GNOME or KDE desktop
    • 64-bit distribution capable of running 32-bit applications
    • GNU C Library (glibc) 2.11 or later
    • 3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android Emulator
    • 2 GB of available disk space minimum, 4 GB recommended (500 MB for IDE + 1.5 GB for Android SDK and emulator system image)
    • 1280 x 800 minimum screen resolution
    • For accelerated emulator, Intel®processor with support for Intel®VT-x, Intel® EM64T (Intel® 64), and Execute Disable (XD) Bit functionality, or AMD processor with support for AMD Virtualization (AMD-V)


Emulator acceleration requires that you install either Intel Hardware Accelerated Execution Manager (Intel HAXM) or Kernel-based Virtual Machine (KVM), which are types of hypervisors. If the needed hypervisor isn't installed, Android Studio typically prompts you to install it. Without acceleration, the emulator takes the machine code from the VM and translates it block-by-block to conform to the architecture of the host computer. This process can be quite slow. However, if the VM and the architecture of the host computer matches (such as x86 on x86), the emulator can skip translating the code and simply run it directly on the actual CPU using a hypervisor. In this case, the emulator can approach the speed of your actual computer.

You can start installing Android Studio from the following URL:


For writing of this book, we have used a Windows 10 system with minimum system requirements. Once you have downloaded Android Studio's .exe file, go through the following steps to finish the installation:

  1. Open the .exe file that you  have just downloaded
  2. Follow the setup wizard and install it using Standard installation

Once you have done this, you will be ready to launch Android Studio with the SDK components needed for Android N; SDK tools version for Android is 25.0.0.

The installation steps are as follows:

Press Next to start with the setup:

Make sure that you have enough space for installation and then proceed by clicking Next:

Once you have read through the terms and agreements, press I Agree to proceed:

Select your desired path for the installation of Android Studio and press Next:

Create a start menu item for quick access and press Install:

Wait until the installation process finishes:

You are now finished with the installation of Android Studio; press Finish to proceed.

Now, you need to configure Android Studio with Android N SDK. The steps to do so, are illustrated as follows:

Since we are installing a fresh copy, select the last option as seen in the screenshot and press OK:

Press Next to proceed:

Select Standard installation for recommended settings:

Press Finish to start downloading the required components.

Once you press Finish, your computer will start downloading the required components for Android N SDK, so ensure that your Internet connection is working and sit back and enjoy a cup of coffee while SDK gets installed on your system:

You have now successfully installed Android Studio and the components needed for Android N.

Once you are done downloading all the components of SDK, you will be ready to start Android Studio and will get the following screen menu:

Congratulations! You are ready to start Android Studio now!


The nuts and bolts of Android

Before you start a new project in Android Studio, there are some basic concepts you must be familiar with. So, let's take a look at a few common terms we will be dealing with in our chapters. 

Package names

The first thing that you will come across is something called a Package Name. It's quite easy to understand actually. A package name is simply like a reverse URL. Think of a package name as your app's domain name-just like a website, only in reverse. For instance, you can think of www.google.com as a website's domain name; in exactly the same way, the naming convention of an Android app is the reverse of a website. So, you can name your app something like com.google.www. There is no strict rule that says that your package name must start from com, but it is the most commonly accepted convention. You can also name your package name randomly using your own set of conventions, such as abc.xyz.lmnmygame.mycompany.mynameand so on. Also, it is extremely important to note that package names must be unique and should not match the package name of any other existing app on the Google Play Store. It is very important to choose a unique package name since the URL gets indexed by Google and is crucial for your game or app to be noticed on the Google Play Store. So, ensure that you use a unique package name for your game. Also, another interesting fact is that you can predict your app's URL even before it goes live if you have finalized it on your package name. For this reason, you cannot use the same package name of another app since it's already live on Google Play Store. Your app will be live according to the following URL convention:


So, if your package name is abc.xyz.lmn, then your app's URL will be as follows:



The next concept is Layouts. We will be dealing with Layouts in the next chapter but, just to give you a small introduction, let's provide a few examples. We will make a game, and in a game, we do not need to display the status bar, which means that we need to have a Fullscreen Layout. If you were making an app, then you probably would not mind allowing the status bar to be displayed on top. So, in this case, you can use a Relative Layout or Linear Layout. The really interesting aspect of this book is that, by the end, you will also have a basic idea of how to create a non-gaming app as well. So, it is highly recommended that you grasp the knowledge of the first three chapters properly.

Android Manifest file

Another important concept while making an Android app or a game is the Android Manifest file. To explain this file simply, it contains all the rules or, in more generalized terms, Permissions needed for an app. You must have observed on Google Play Store that, before you download any app, you are prompted with a dialog box that tells you what permissions are needed for the app to run. These permissions are basic rules that are needed to be fed in the Android Manifest file in order to have a transparency to let your user know what information is going to be taken from them. So, for instance, if an app requires access to the Internet, then it is required for the developer to make sure that they include the Internet permission in the manifest file. If the developer does not write this permission in the manifest file, then the app will not be able to access the said functionality, and the same goes for accessing contacts, gallery, camera, and everything else.

These are the three most important things you need to keep in mind before you start developing any Android game or an app.

In the next chapter, we will get started with our first project on Android Studio.



In this chapter, we have learned some basic information about Android as well as how to install Android Studio, which will help us on our journey to developing our apps. We also configured Android studio with components of Android N; you are now ready to get started with game development in Android.

Now that we have installed Android Studio, we will be learning how to execute/run our first program in the next chapter. Fasten your seatbelts, you are in for a ride!

About the Author

  • Nikhil Malankar

    Nikhil Malankar started his journey into game development in 2011 by founding his company, GameEon, as the CEO, at the age of 17. GameEon has developed over 70+ games, of which 10 are available for download on Play Store and others are distributed worldwide via multiple distribution channels. Currently, he is running his new company--Next Move Digital--as the founder and CEO. Next Move Digital deals in digital media and game development.

    He has a total experience of 5 years in the field of game development and has worked on technologies such as Pygame (a subset of Python) to create GameEon’s first game, Kyte - Kite Flying Game, which has over 300,000 downloads on Google Play. He is also familiar with the Unity Game engine and has developed most of the games at GameEon in the same. He has also worked with Unreal Engine 4 to develop Special Ops, a first person shooter game for Android and iOS.

    He has also developed non-gaming apps and websites for clients. At GameEon, he also worked with multiple clients to develop games for them, and one of the most famous brands he has worked with is m-Indicator. He is also a social media influencer with a big following of his own on Facebook and is extremely passionate about playing games. With Next Move Digital, he aims to work on content creation, distribution, and licensing. He also operates a content website--Tell Me Nothing--under Next Move Digital, which focuses on lighthearted satirical content. His future endeavors with the company include making good-quality games for PC and console platforms.

    Currently, he is running Next Move Digital, as the Founder and CEO, that focuses on creating digital media content.

    Browse publications by this author
Book Title
Access this book, plus 7,500 other titles for FREE
Access now