Pr.Pg Next Pg

Running the Application tutorials

Running on a Real Device

  • If you have a real Android-powered device, here's how you can install and run your app:

  • Plug in your device to your development machine with a USB cable. If you're developing on Windows, you might need to install the appropriate USB driver for your device

  • Enable USB debugging on your device.

  • On most devices running Android 3.2 or older, you can find the option under Settings > Applications > Development.

  • On Android 4.0 and newer, it's in Settings > Developer options.

 

Note

  • On Android 4.2 and newer, Developer options is hidden by default. To make it available, go toSettings > About phone and tap Build number seven times. Return to the previous screen to findDeveloper options.

 

To run the app from Eclipse:

  • Open one of your project's files and click Run Description: http://developer.android.com/images/tools/eclipse-run.png from the toolbar.

  • In the Run as window that appears, select Android Application and click OK.

  • Eclipse installs the app on your connected device and starts it.

  • Or to run your app from a command line:

  • Change directories to the root of your Android project and execute:

ant debug

Make sure the Android SDK platform-tools/ directory is included in your PATH environment variable, then execute:

adb install bin/HelloAndroid-debug.apk

On your device, locate Hello Android and open it.

 

Running on the Eclipse Emulator

  • First open the Android Virtual Device Manager .

 

 

  • Select the AVD which we have already created before from the Android Virtual Device Manager and click Start.

  • After the emulator boots up, unlock the emulator screen.

To run the app from Eclipse:

Open one of your project's files and click Run Description: http://developer.android.com/images/tools/eclipse-run.png from the toolbar.

In the Run as window that appears, select Android Application and click OK.

Eclipse installs the app on your AVD and starts it.

Or to run your app from the command line:

Change directories to the root of your Android project and execute:

ant debug

Make sure the Android SDK platform-tools/ directory is included in your PATH environment variable, then execute:

adb install bin/HelloAndroid-debug.apk

On the emulator, locate Hello Android and open it.

  • When we run our app, we can see that as we click on Click Me button, the number of times the button is clicked is displayed.

 

 

Pr.Pg border                                              Next Pg