Reader small image

You're reading from  The Android Game Developer???s Handbook

Product typeBook
Published inAug 2016
Reading LevelBeginner
PublisherPackt
ISBN-139781785885860
Edition1st Edition
Languages
Right arrow
Author (1)
Avisekhar Roy
Avisekhar Roy
author image
Avisekhar Roy

Avisekhar Roy is a B.Tech engineer in computer science. He has had a passion for coding since his school days. However, he had no plans to become a game programmer. His fate landed him in the gaming industry in 2010. Since then, he fell in love with game development. Avisekhar has worked in many formats of game development environment, ranging from small companies and individual studios to corporate companies and full-scale game development studios. He recently started his own gaming start-up in 2016 and is currently working on games for the mobile platform. Avisekhar has also worked with some big companies, such as Reliance Games in India, as well as a small-scale studio called Nautilus Mobile. He is now trying to acquire a position in the gaming industry for his own venture, Funboat Games.
Read more about Avisekhar Roy

Right arrow

Chapter 3. Different Android Development Tools

We have already discussed the different Android target devices for game development. In this chapter, we will take a look at the different ways and tools to develop games for Android. Other than development skill and knowledge, it is very important to know about the helpful software that can make the development process easier and effective.

Android game development is supported or backed by many powerful tools and libraries. Let's have a look at the list of mandatory tools for the development process:

  • Android SDK

  • Android Development Tool

  • Android Virtual Device

  • Android Debug Bridge

  • Dalvik Debug Monitor Server

These are the must-have tools that should be installed in an Android game developer's system. Without these, it is impossible to develop anything for the Android platform. Although ADB and AVD are not mandatory for development, they are required to test and deploy the game on physical as well as virtual devices in order to debug the game.

Android SDK


Android SDK is the main development kit required to build any application for Android. Without going into details, it can be said that the SDK is the skeleton for any Android development. This SDK itself comes with dozens of support tools. It contains platform details, APIs, and libraries along with ADT and AVD. So having Android SDK integrated in the system provides the developer with all the necessary tools. It is a very good practice to always update the SDK with the latest platforms and other tools.

Upgrading can be done through the Android SDK manager. However, platform selection is manual, and it is recommended to have only the necessary platforms as per requirements. Another best practice is to have the latest released platform along with the minimum targeted version of Android (image source: http://photos4.meetupstatic.com/photos/event/1/1/0/f/highres_441724367.jpeg):

Android Development Tool


Android Development Tool (ADT) is a plugin for the Eclipse IDE that is designed to give a powerful, integrated environment in which to build Android applications.

ADT extends the capabilities of Eclipse to let the developer quickly set up new Android projects, create an application UI, add packages based on the Android framework API, debug the applications using the Android SDK tools, and even export signed (or unsigned) .apk files in order to distribute the application.

Developing in Eclipse with ADT is highly recommended, and is the fastest way to get started. With the guided project setup it provides, as well as tools integration, custom XML editors, and the debug output pane, ADT gives an incredible boost to developing Android applications.

However, ADT support for Eclipse is being pulled by Google, so developers are recommended to switch to Android Studio.

Android Virtual Device


An Android Virtual Device (AVD) is a software-produced model of a real device, which can be configured with custom hardware specifications. It can be a virtual copy of the real device as well. This is one of the most important tools for any Android developer. This lets the developer test the application in a typical Android environment without using an actual hardware device, to cut short the development time (image source: http://www.geeknaut.com/images/2014/08/top-android-emulators-for-windows3.png):

Configuring AVD

An AVD consists of the following:

  • Hardware profile: This profile describes the hardware features of the virtual device. This can be configured with hardware options like a QWERTY keypad, camera, integrated memory, and so on.

  • System image mapping: The running Android platform version can be configured depending on the installed set of Android platforms. Android platforms can be installed by the Android SDK manager.

  • Dedicated disk space: Dedicated storage...

Android Debug Bridge


Android Debug Bridge (adb) is a tool used to establish communication between the development environment and a virtual device or the connected Android device. It is a client-server command-line program, which works on three elements:

  • Client on the development machine: Works as the client, which can be invoked by adb commands. Other Android tools such as the ADT plugin and DDMS also create adb clients.

  • Daemon: A background process that runs in the background on each emulator or device instance.

  • Server on the development machine: This is a background process that runs on the development machine and manages the communication between the client and server.

On starting adb, the client first checks whether there is an adb server process already running. If there isn't, it starts the server process. When the server starts, it binds to the local TCP port 5037 and listens for commands sent from adb clients—all adb clients use port 5037 to communicate with the adb server.

The server...

Dalvik Debug Monitor Server


The Dalvik Debug Monitor Server (DDMS), whether it's accessed through the standalone application or the Eclipse perspective with the same name, provides handy features for inspecting, debugging, and interacting with emulator and device instances. You can use DDMS to inspect running processes and threads, explore the filesystem, gather heap and other memory information, attach debuggers, and even take screenshots. For emulators, you can also simulate mock location data, send SMS messages, and initiate incoming phone calls:

As the preceding screenshot shows, DDMS can primarily track, update, and display the following information:

  • All running processes

  • All running threads per process

  • Consumed heap per process

  • All log messages

On Android, every application runs in its own process, each of which runs in its own virtual machine. The debugger can be attached to the exposed port of VM. DDMS connects to adb on start. On successful connection, a VM monitoring service is created...

Other tools


The elements mentioned in the previous sections are the minimum requirement for Android development, with which a full application can be created. However, the development process can become much easier with the support of a few other tools. Let's have a look at a few of such tools. These tools are not mandatory for Android development, but they are recommended to be used for a better development process.

Eclipse

Although Eclipse is not the only Java development environment that can be used to develop Android applications, it is by far the most popular. This is partially due to its cost (free!), but mostly due to the strong integration of Android tools with Eclipse. This integration is achieved with the ADT plugin for Eclipse, which can be downloaded from the Android website.

Use of Eclipse for Android development is a well-known practice for many developers. Some of the reasons for this are as follows:

  • Free Eclipse IDE

  • Direct Android plugin support

  • Direct DDMS support

  • Simple interface...

Tools for testing


For any development process, testing is of major importance. For Android game development too, there are a few tools and processes to make testing easier.

Creating a test case

Activity tests are written in a structured way. Make sure to put your tests in a separate package, distinct from the code under test. By convention, your test package name should follow the same name as the application package, suffixed with .tests. In the test package you created, add the Java class for your test case. By convention, your test case name should also follow the same name as the Java or Android class that you want to test, but suffixed with Test.

To create a new test case in Eclipse, perform the following steps:

  1. In Package Explorer, right-click on the /src directory for your test project, and select New | Package.

  2. Set the Name field to <package_name>.tests (for example, com.example.android.testingfun.tests), and click on Finish.

  3. Right-click on the test package you created, and select...

Performance profiling tools


Putting pixels on the screen involves four primary pieces of hardware: the CPU computes display lists, the GPU renders images to the display, the memory stores images and data, and the battery provides electrical power. Each of these pieces of hardware has constraints; pushing or exceeding those constraints causes your app to be slow, worsens the display performance, or exhausts the battery.

To discover what causes your specific performance problems, you need to take a look under the hood, use tools to collect data about your app's execution behavior, surface that data as lists and graphics, understand and analyze what you see, and improve your code.

Android Studio and your device provide profiling tools to record and visualize the rendering, computing, memory, and battery performance of your app.

Android Studio


Android Studio is the official IDE for Android application development, based on IntelliJ IDEA. On top of the capabilities you expect from IntelliJ, Android Studio offers the following among many others:

  • Flexible Gradle-based build system

  • Build variants and multiple .apk file generation

  • Code templates to help you build common app features

  • Rich layout editor with support for drag and drop theme editing

  • lint tools to catch performance, usability, version compatibility, and other problems

  • ProGuard and app-signing capabilities

  • Built-in support for the Google Cloud platform, making it easy to integrate Google Cloud messaging and App Engine

If you're new to Android Studio or the IntelliJ IDEA interface, this section provides an introduction to some key Android Studio features.

Android project view

By default, Android Studio displays your project files in the Android project view. This view shows a flattened version of your project's structure, which provides quick access to the key source...

Cross-platform tools


Although we are only talking about Android game development, game development cannot be efficient without cross-platform support. We have already discussed game design flexibility. From a typical technical perspective, it should be possible to deploy the game for various platforms such as iOS, Windows, consoles, and the like.

Always keep in mind that cross-platform mobile development isn't quite as simple as writing the code once, putting it through a tool for translation, and publishing both an iOS and Android app to the respective app stores.

Using a cross-platform mobile development tool can reduce the time and cost associated with developing apps on both platforms, but the UI needs to be updated to match each system. For example, adjustments are needed between the two so that the menu and control commands match the UX of how Android devices and iOS devices inherently operate in different ways.

There are plenty of tools that support cross-platform development. Let's...

Summary


Development tools are essential for any game development; however, they have always been low priority in game design and the pre-development analysis stage. The necessity for these tools is realized when they are required.

We have discussed all the mandatory tools for Android development only. But modern age game development demands flexibility across hardware platforms as well as operating systems. This is where cross-platform development engines come into the picture. These tools help the development process to become faster and more efficient; however, this comes at the cost of a little drop in performance and a larger build size. In most cases, developers have limited control over the cross-platform engine, but full control can be gained if the game is developed on native SDKs.

Development tools are not just useful for development and debugging—they are very efficient in optimizing the game along with data protection, which might not have a direct impact on games. A good developer...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
The Android Game Developer???s Handbook
Published in: Aug 2016Publisher: PacktISBN-13: 9781785885860
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Avisekhar Roy

Avisekhar Roy is a B.Tech engineer in computer science. He has had a passion for coding since his school days. However, he had no plans to become a game programmer. His fate landed him in the gaming industry in 2010. Since then, he fell in love with game development. Avisekhar has worked in many formats of game development environment, ranging from small companies and individual studios to corporate companies and full-scale game development studios. He recently started his own gaming start-up in 2016 and is currently working on games for the mobile platform. Avisekhar has also worked with some big companies, such as Reliance Games in India, as well as a small-scale studio called Nautilus Mobile. He is now trying to acquire a position in the gaming industry for his own venture, Funboat Games.
Read more about Avisekhar Roy