Android game programming deploying the app device

Deploying to an android device is a matter of downloading the correct drivers for the device, plug device into your laptop/pc, enable debugging  and deploy to the device.  If you are using a Mac OS X or Linux then you don’t need to install a USB driver.

There are two types of drivers available but it does depend on the device.  If you are using and Android phone or Android Developer including Nexus One or a Nexus S phone, you will need to get the Google USB drivers.  If you have a Samsung, HTC, Acer or some other type of rebadge device then you will need to download the OEM USB drivers.  For more information on the required driver see the Android OEM drivers .  Follow the instructions on this site to install the OEM drivers.

If you have a Nexus One/Nexus S or an Android phone then you can use Eclipse to download and install the drivers for you.

Click on the SDK Manager icon.  From the SDK manager window expand the Extras folder and check the Google USB driver packages.  Click install and the driver will download and install.

Turn your attention to your device and it’s time to enable debugging.  Depending on your device this can be done in two different ways.  Try the first method by selecting Settings –> Applications –> Development –> USB debugging.  If this doesn’t work for you try the following.  Settings –> Developer Options –> USB debugging (Debug mod when USB is connected).

Connect the device to the PC/laptop and open a command prompt by going to the start button and typing cmd.  Change the path to the location where you downloaded the Android SDK and enter the platform-tools folder.  My location looks like this although yours may differ,

C:\Android -SDK\sdk\platform-tools

So you would enter

cd C:\Android -SDK\sdk\platform-tools

Now enter the following and press enter.

adb devices

Eclipse Device

If all went well then a device ID number will appear.   If nothing appears then it is possible that you have the wrong driver installed.  Another possibility is that you have forgotten to enable debugging on the phone or that the USB cable isn’t inserted correctly.  The Nexus S phone USB connection sometimes becomes a little loose.  You can also take a look at your Android device to see if you have a small Android head icon and a notification regarding debugging.  This indicates that debugging is enabled.

Back to Eclipse now.  Right click on the Hello World project and select Run As –> Run Configuration –> Android Application. Select the Target tab and make sure that this is set to Always prompt to pick device. The reason that this is set to this option is because you can automatically inform Eclipse that every time you deploy an app it will use the same configuration each time.  When this is set to prompt, Eclipse will ask you each time which device or emulator you would like to deploy the app to.  This is the preferred option for now because we will be jumping back and forth to the emulator.

Eclipse Target Configuration

Click Run.  Another window will appear with your device.  Highlight this and click ok.

Android device chooser

 

The window will display the device name or serial number including the target platform which is 4.1.2.  Click OK.

If you take a look at your device the app should appear displaying the HelloWorld app including the Hello Android text view message.  Exit the application on your phone and take a look at the installed applications.  You should see a HelloWorld app icon.

Android hello world application

Click on this icon to launch the application.

Android game programming previewing the app

Next Android Game Programming Week 2- Day 4.0  Previewing the App >>