Learning Java by Building Android  Games
上QQ阅读APP看书,第一时间看更新

Running the game on an Android emulator

Follow these simple steps to run the game on the default Android emulator.

  1. On the Android Studio menu bar select Tools | Android AVD Manager. AVD stands for Android Virtual Device (an emulator). You will see the following window.
    Running the game on an Android emulator
  2. Notice there is an emulator in the list. In my case, it is Pixel API 25 if you are following this sometime in the future it will probably be a different emulator that was installed by default. It won't matter. Click the green play icon shown in the next image and wait while the emulator boots up.
    Running the game on an Android emulator
  3. Now you can see the emulator as shown in the next image. Note also in the next image I have highlighted one of the icons in the control panel to the right of the emulator. Click that icon to rotate the phone into landscape mode ready to run the game.
    Running the game on an Android emulator
  4. Now you can click the play icon on the Android Studio quick-launch bar as shown in the next image and when prompted choose Pixel API 25 (or whatever your emulator is called) and the game will launch on the emulator.
    Running the game on an Android emulator

You're done. Here is what the running game looks like so far:

Running the game on an Android emulator

Clearly, we have more work to do but it is a good start. Let's see how to do the same on a real device and then we can go about building Sub' Hunter further.