Test your app on an Android device
Now you’ve successfully run your app in the emulator, you can try running it on a real device. First you need to ensure that the USB driver is installed in the Android SDK and AVD manager. Choose ‘Window > Android SDK and AVD manager > Available packages’. Select the Android repository, ensure that the USB driver is ticked and click ‘Install selected’.
Connect your phone to a spare USB port and wait for Windows to detect it. In the New Hardware wizard, choose ‘Locate and install drivers’ and opt to browse your computer for the driver software. Browse to the ‘Android SDK’ folder and locate the subfolder for the USB driver. Windows should find and install it from here.
Now you need to declare your app as debuggable. In Eclipse, expand your HelloAndroid application and double-click ‘AndroidManifest.xlm’. Move to the ‘Application’ tab and select ‘True’ from the Debuggable dropdown list. Save the project.
Go to your Android phone and choose ‘Menu’ from the home screen, then select ‘Applications > Development’ and enable USB debugging. Now you can reconnect it to your PC via USB. If you want to check that the SDK can see your phone, browse to the ‘Tools’ directory in your ‘Android SDK’ folder. Launch ‘adb.exe’ and you should be able to see your phone listed as ‘Device’.
To launch your application on the connected phone, you need to choose ‘Run > Run > Android application in Eclipse’. Now you have both the emulator and your phone connected, you need to specify which you want to run it on. Eclipse presents you with a Device Chooser that lists all the available devices and emulators. Select your phone from this list to install and run the app.
Now you’ve produced and run a very basic application from raw code in an emulator and on an Android device, you can begin to learn how to develop your own. It helps to have some knowledge of Java programming, but you’ll also find a number of stepped tutorials in the Android Developer Resources pages.
These include introductions to the different views available to apps and how to implement them. You’ll also find ways to use common resources like location information, and find out how to debug your work.
You can find a full list of sample code on these pages too. This will help you to work through example applications that you can modify to your own ends. These include games such as Snake and Lunar Lander, plus utilities like Note Pad and Wiktionary. You can find even more samples at Apps-for-Android.
Have fun developing your first Android App.
Credit: Joe Cassels of Techradar