Running on a Real Device

Running an Android program on a physical device such as the Nexus 5 during development is almost identical to running it on the emulator. On Android 4.2 and above, you need to enable developer mode on the device itself by starting the Settings application and selecting “About phone” or “About tablet” and tapping on the Build number seven times (that’s a little Easter egg from the Android developers). Then enable USB debugging by selecting Developer options > Debugging > USB debugging.

On your computer, install the Android USB device driver if you haven’t already (Windows only), and then plug the device into your computer using the USB cable that came with the unit.

Getting the USB driver running for the first time ...

Get Hello, Android, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.