Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Android Development: How to Set Up Your Mobile Device for Testing

DZone's Guide to

Android Development: How to Set Up Your Mobile Device for Testing

· Java Zone
Free Resource

Get the Edge with a Professional Java IDE. 30-day free trial.

This article presents a quick tip on how to have your android app (developed using Android IDEs such as Eclipse or Titanium-based IDE) installed on your mobile device and have them tested right from your mobile device rather than from an emulator.

While trying to get this done with both Samsung and Motorola mobile handset, I failed on following front when I was working with Titanium IDE:

Titanium IDE was unable to detect android device. All that I did was connect my mobile device and laptop with a cable and, expected magic to happen.
After doing a little research, I figured out what needs to be done on both mobile and laptop for getting you setup such that your mobile app that you are developing, gets tested on your device. Following are key steps:
  • Configure your mobile device
  • Install/Configure on your laptop/desktop

Configure your Mobile Device

Assuming you have got latest android mobile devices, following shall work in all probabilities. I tested with Motorola (Moto G) and Samsung S3 handset.

  • On your mobile device, goto Settings and click “Security”
  • Check the “Unknown sources” which would allow installation of apps from unknown sources such as your desktop/laptop
  • Back on Settings screen, click on “Developer Options”.
  • Check “USB debugging” which will enable your device in debug mode. If you want to use mock locations, check on “Allow mock locations”. You may also want to check “Stay awake” to have your device active when you are working with your app.

That is it. You are all set.

Install/Configure on your Laptop/Desktop

Do following and you should be all set.

  • Install appropriate XXXX (Motorola/Samsung/any other…) Device Manager in order to install and configure appropriate USB drivers to connect mobile devices to your computer. For example, for Motorola, install Motorola Device Manager. For Samsung, install Samsung Kies Device Manager.
  • Connect the mobile device and appropriate USB drivers would be installed.
  • Once USB drivers get installed, go to ANDROID_HOME/tools directory, and execute “adb devices”. If connected, it would display your device name.

Execute “adb start-server”

Once above two steps are done, all that is needed to get started installing your app on mobile device is execute following command:

“adb start-server”

With above done, go to Titanium IDE and run the project on Android device. And, your app would be run on your mobile device.

Get the Java IDE that understands code & makes developing enjoyable. Level up your code with IntelliJ IDEA. Download the free trial.

Topics:

Published at DZone with permission of Ajitesh Kumar, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}