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

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.

主站蜘蛛池模板: 广东省| 正镶白旗| 婺源县| 克山县| 淮滨县| 神木县| 芜湖县| 松江区| 荔浦县| 阿克苏市| 屏东市| 大港区| 西乡县| 台北县| 大港区| 屯门区| 岑巩县| 苏尼特左旗| 怀化市| 公主岭市| 文水县| 巴楚县| 扶绥县| 南康市| 屏南县| 丰台区| 株洲县| 黄浦区| 泸定县| 海阳市| 昌平区| 东阿县| 达日县| 深圳市| 长寿区| 宁晋县| 黑龙江省| 武汉市| 兴义市| 鹿邑县| 玉山县|