官术网_书友最值得收藏!

Deploying the game

Now, we can run our game to see our spaceship floating through space (starting at 50 pixels on the x axis and 50 pixels on the y axis).

Android Studio enables us to fairly quickly create emulators, on which we can test our games on a development PC. However, even the most simple of games will not run well on an emulator. When we start testing things like player input, the experience is so awful that it is best to avoid using emulators completely.

The solution is to carry out debugging on a real Android device. It is very easy to prepare for this.

Debugging on an Android device

The first thing to do is to visit your device manufacturer's website and obtain and install any drivers that are required for your device and operating system.

The next few steps will setup the Android device for debugging. Note that different manufacturers structure the menu options slightly differently than others. The following sequence is probably very close, if not exact to enable debugging on most devices.

  1. Tap the Settings menu option or the Settings app.
  2. Tap Developer options.
  3. Tap the checkbox for USB Debugging.
  4. Connect your Android device to the USB port of your development system. The next image shows on the Android tab. At the bottom of the Android Studio UI, you can see that Samsung GT-I9100 Android 4.1.2 (API 16) has been detected:
  5. Click on the Play icon from the Android Studio toolbar:
  6. When prompted, click on OK to run the game on your chosen device.

The game will now run on the device. Any output or errors can be seen in the logcat window, also on the Android tab:

Watch with awe as our player's spaceship moves slowly from left to right.

主站蜘蛛池模板: 红原县| 景泰县| 枣阳市| 司法| 浑源县| 分宜县| 胶州市| 青田县| 利津县| 扬州市| 英超| 清镇市| 历史| 韩城市| 惠来县| 道孚县| 嘉定区| 石泉县| 广元市| 祁门县| 唐山市| 兴安县| 黑山县| 犍为县| 杭州市| 榆中县| 新蔡县| 乐都县| 乌兰县| 偏关县| 吉安县| 洛川县| 威信县| 临汾市| 阳城县| 龙州县| 黎平县| 永年县| 冀州市| 衡阳县| 佛冈县|