Lesson 0.7: Running an Android app in a real device (but you don’t need any to create an app)
It’s difficult to test your app on dozens various devices, so described in previous lesson emulators are really helpful. But if you have any real Android device, you could run on it your apps. You don’t need to register anywhere or buy anything to do it (by the way those steps are necessary to create and test iOS apps). All you need beside your phone or tablet is a USB cable (usually delivered with device) and USB driver (available for free in Internet).
There are some big benefits of running apps on real devices – it’s much faster than in emulator and you could fully test all options, like multi touch or camera.
Step 1: Let’s start with a driver. The standard Windows driver for connecting a device is usually not enough. You have to find a dedicated driver for your phone or tablet. It should be available at manufacturer website. Google created a special instruction for driver installation and also the list of support sites of main manufactures (direct link to that list is http://developer.android.com/tools/extras/oem-usb.html).
You could also search web using phrase like: “your-device-name ADB USB driver ”. ADB is Android Debug Bridge responsible for connecting device and developer tools.
When you download a driver, you just proceed with standard installation.
Step 2: Now we have to change some settings into a device. It won’t break anything – just we have to enable downloading apps that are under development.
This option is called USB debugging and is located into Settings | Applications | Development (or Settings | Developer options in some Android editions). There is a special procedure for the newest Android system versions. Options for developers are hidden until you go into Settings | About phone and… click seven times Build number.
This is probably for lucky start!
Step 3: When driver is installed and USB debugging is enabled, connect a device to the computer. The system should find your phone or tablet. If Windows Explorer window opens, just close it. Go back to Android Studio.
Step 4: Press Run icon or choose from menu Run | Run ‘your app name’. You should see a connected device on the list.
If the list is empty, try to restart program, restart computer, reconnect device to computer, connect device to another USB port, reinstall driver, try another driver and finally Google suggestions for your specific device… Some devices are visible immediately, others need many experiments. Fortunately most new devices belongs to the first group.
Step 5: Choose the device from the list of and click OK. The app would be copied to your device and then started. Now you could use it as other apps in the phone or tablet.
Note that the app stays in your device even if you disconnect it from computer or restart it. You could delete it as other installed apps.