Run an Android Project on your Android Phone
16th Sep 2012
In this tutorial, you will learn how to run an Android application project on a physical Android device. We will perform a basic setup for your device to ensure that your Android application will be debuggable. You can use any Android device as an environment for running, debugging, and testing your applications. So lets begin…
- USB data cable for your device.
- Android OS(Operating System) device.
- Installed the appropriate driver for your Android device on your computer.
SETUP PHONE AS DEBUG MODE
Connect your USB data cable to your device. Switch on your device and Tap on Settings as shown on the screenshot below.
Now scroll down and locate Developer options in your device settings.
Tick the USB debugging checkbox.
RUN AN ANDROID APPLICATION PROJECT
Start Eclipse, select the project we have create on our previous post and click Run or press Ctrl-F11. In the device chooser, select “choose a running Android device” and select your Android device as shown on the screenshot below.
You should now see the compiled project on your Android device. By compiling and running projects on your physical Android device, you could easily interact with your own apps or do some in-depth testing or debugging.
DEBUG AN ANDROID APPLICATION PROJECT
To debug your app, select the icon shown on the screenshot below or press F11 on your keyboard.
Choose your device on the device chooser and click OK. While starting debug mode, you should see a dialog showing “Waiting For Debugger” on your Android device.
Lets try to debug this application, open your MainActivity.java and insert a breakpoint next to the TextView as shown on the screenshot below.
Now tap on the button on your Android application. The breakpoint should stop the application from running pass the TextView as shown on the screenshot below.
Press F6 one at a time to see how the application runs. Use this debugging method to check for coding errors in your future application development. To resume the activity, press F8. If you encounter any errors that forces your application to close, be sure to check on the logcat view in your Eclipse.