If you have just completed the tutorial Building your first Android game or if you have just forgotten how to get your latest project from your PC and onto a device – here is how to do it.
This tutorial will show you how to run the game on your device while connected via a USB cable. Once you have done this the game will remain on your device to play, with or without being connected to your development machine.
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 to others. But the following sequence is probably very close, if not exact for enabling debugging on most devices.
- Tap the Settings menu option or the Settings app on your phone/tablet.
- Tap Developer options.
- Tap the checkbox for USB Debugging.
- Connect your Android device to the USB port of your development system.
- Click the Play icon from the Android Studio toolbar as shown.
When prompted click OK to debug the game on your chosen device.
The game will now run on the device like shown.
As we progress through the tutorial related mini-projects we will see how the device outputs information to Android Studio so we can monitor and debug our games. This is the next Android tutorial designed to be read in conjunction with these Java tutorials.