In this section, you will set up your system, device, and application to get GeoQuiz running on your hardware device.
First, plug the device into your system. If you are developing on a Mac, your system should recognize the device right away. On Windows, you may need to install the adb (Android Debug Bridge) driver. If Windows cannot find the adb driver, then download one from the device manufacturer’s website.
To test apps on your device, you need to enable USB debugging on it.
Developer options is not visible by default. To enable it, go to Settings → About Tablet/Phone and press Build Number seven times. Then you can return to Settings, see Developer options, and enable USB debugging.
The options vary considerably across devices. If you are having problems enabling your device, visit developer.android.com/tools/device.xhtml for more help.
You can confirm that your device is recognized by opening the Devices view. The quickest way to the Devices view is to select the Android Monitor tool window near the bottom of Android Studio. Inside of this window, you will see a drop-down list of connected devices (Figure 2.7). You should see your AVD and your hardware device listed.
If you are having trouble getting your device recognized, verify that your device is turned on and the developer options are enabled.
If you are still unable to see your device in the devices view, you can find more help on the Android developers’ site. Start at developer.android.com/tools/device.xhtml. You can also visit this book’s forum at forums.bignerdranch.com for more troubleshooting help.
Run GeoQuiz as before. Android Studio will offer a choice between running on the virtual device or the hardware device plugged into your system. Select the hardware device and continue. GeoQuiz will launch on your device.
If Android Studio defaults to your emulator without offering a choice of device to run the app on, recheck the steps above and make sure your device is plugged in. Next, ensure that your run configuration is correct. To modify the run configuration, select the app drop-down list near the top of the window, as shown in Figure 2.8.
Choose Edit Configurations... and you will be presented with a new window with details about your run configuration (Figure 2.9).
Select app in the left pane and verify that Deployment Target Options is set to Open Select Deployment Target Dialog and that Use same device for future launches is unchecked. Select OK and re-run the app. You will now be presented with a choice of device to launch the app on.