Sunday, 9 February 2014

Running Android application on device from eclipse in Ubuntu/Linux

While for windows this process might be as simple as a click on the run button with debugging mode enabled on the device, with Ubuntu it needs a little configuration changes.

So, Here is how you can do it with Ubuntu/Linux:-

Step 1: Setup eclipse with Android development kit.

Download from here developer.android.com

Extract the zip file.

cd to the extracted drive and run eclipse.

Step 2: Create and android application.

how to do that : first android app

Step 3: connect your android device over USB, And enable USB debugging option (under Settings -> Developer options)

Step 4: Run the application from the run button on top.


if you get a pop up box like this, that means that eclipse is unable to access the USB device.

Step 5: Enable access to the USB device.

open terminal and run this command:
    lsusb

Bus 002 Device 001: ID 1abc:0abc Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 1abc:0abc Ricoh Co., Ltd
Bus 001 Device 005: ID 1abc:0abc Foxconn / Hon Hai
Bus 001 Device 002: ID 1abc:0abc Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1abc:0abc Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1abc:0abc Linux Foundation 3.0 root hub
Bus 003 Device 010: ID 0bb4:0cac HTC (High Tech Computer Corp.) 
Bus 003 Device 002: ID 1abc:0abc Lite-On Technology Corp.
Bus 003 Device 001: ID 1abc:0abc Linux Foundation 2.0 root hub
 
 
Here the vendor id is 0bb4, and the product id is : 0cac

Now open file

    sudo vim /etc/udev/rules.d/51-android.rules
 
And add the following lines:

    # fastboot protocol on manta (HTC Incredible S)
    SUBSYSTEM=="usb", ATTR{idVendor}=="<vendor id>", ATTR{idProduct}=="<product id>", MODE="0600", OWNER="viki"

Unplug the device and re-plug it.

Step6: Open Eclipse and re-run the application.
It should open up in the device.

And questions or suggestions please leave them in the comments below.

---
Thanks
viki