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

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.

主站蜘蛛池模板: 乐安县| 和政县| 木里| 井陉县| 抚远县| 迁安市| 洛川县| 平武县| 南雄市| 新余市| 平泉县| 云龙县| 泰和县| 屏南县| 临猗县| 新民市| 玉田县| 清新县| 安平县| 禹城市| 曲周县| 溧阳市| 灵宝市| 阿荣旗| 新泰市| 玉溪市| 姚安县| 宁南县| 祥云县| 宕昌县| 平泉县| 三门县| 华蓥市| 德钦县| 玛沁县| 辽宁省| 合作市| 广安市| 什邡市| 梅州市| 仁化县|