Testing on multiple devices

It is necessary to test the game on as many different devices as possible. The game might look and feel very different on tablets and phones and even on two similar phones. Moreover, some phones define their own ways of handling the application life cycle, especially pausing and resuming. Testing on a few major brands and popular devices is always recommended.

Using an emulator

Testing on different devices is not always an option for many reasons. In that case, we should test at least a few different resolutions in an emulator. An emulator can never substitute testing on a real device. It is missing many features of phones and tablets and, of course, even the implemented functionality is just an emulation.

To run the game on an emulator, first start the Android Virtual Device Manager from Eclipse. The option is located in the main button bar and in the Window menu.

In the current version of the SDK, we have two options: creating a new device or cloning an emulation of an existing device. We will create a new one. Let's click on the New button in the manager and create a new phone emulation. We will be presented with the window shown in the following screenshot:

Using an emulator

The parameters used are just an example, but the device will do just fine. The resolution will fit nicely on the screen. We are using the latest available Android SDK, at the time of writing this book. The RAM parameter should be set to at least 512 MB in order to run the latest Android somewhat smoothly. The Use Host GPU option means that the graphics will be emulated on a graphics card instead of the CPU, which usually brings a significant performance boost. However, the built-in emulator is still quite slow even on the latest machines.

Tip

As an alternative, we can use the Genymotion emulator or install the HAXM Intel driver and Intel Atom Android images. Genymotion is a virtual machine, which performs better than the built-in emulator, and the HAXM driver uses hardware virtualization to speed up the bundled emulator to run faster.

After creating the device, it appears in the run dialog and we can run our game the same way as we did on the real device, as shown in the following screenshot. We can use the adb command-line tool and install the production APK in the emulator as well.

Using an emulator

The following screenshot shows how it looks when our game runs successfully in the emulator:

Using an emulator
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.196.244