How to Connect Your Android Device to Ubuntu

I recently wanted to transfer some of my pics i did in Poland (PyconPl) from my android galaxy tablet to my Ubuntu 12.04 LTS machine, but the tab was not recognized and a notification didn't show up.

 There are many people and computer geeks that have this problem, so I thought to share the solution of this problem in this article. In the future I will write a python script that will automate everything and do the job for you,  but at  the moment I am very busy with other projects and school.

 Note: Everything is tested in Ubuntu 12.04 and Galaxy Tab 2 7.0 which runs Android 4.0.3. Ok linux geeks, open a new terminal in your machine now and run the following command to install the libusb C library which gives applications easy access to USB devices.

sudo apt-get install libusb-dev

After the installation of the libusb-dev library is finished, download the libmtp which is an implementation of the Media Transfer Protocol. The libmtp software library will help us to handle MTP devices on Linux.

If you want more information read this article about transferring files via usb on android devices and understand MTP and PTP.

After the download of the libmtp is finished, run the following command to decompress it.

gunzip libmtp-1.1.6.tar.gz

Extract the archive with the following command.

tar xvf libmtp-1.1.6.tar

Change directory and compile libmtp.

cd libmtp-1.1.6
 configure –prefix=/usr


sudo make install

Copy the rules from the libmtp-1.1.6  directory to /etc/udev directory.

 cp 69-libmtp.rules /etc/udev/rules.d

Install gmtp with the following command.

sudo apt-get install gmtp

Open a new terminal, launch gmtp from there and connect your android device via usb. Tatata, it is working.

how to connect your android device to ubuntu

Click the Connect button and everything should be ok.

how to connect your android device to ubuntu

5 Comments... add one

  1. tried U 12.04 lts (32 bit) with nexus 5:

    all installed well. but gmtp hangs:

    # gmtp
    Device 0 (VID=18d1 and PID=4ee1) is UNKNOWN.
    Please report this VID/PID and the device model to the libmtp development team
    PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
    LIBMTP libusb: Attempt to reset device
    Android device detected, assigning default bug flags

  2. p.s.: my /etc/udev/rules.d/51-android.rules

    SUBSYSTEM==”usb”, ATTR{idVendor}==”18d1”, ATTR{idProduct}==”4ee1”, MODE=”0666″
    SUBSYSTEM==”usb”, ATTR{idVendor}==”18d1”, ATTR{idProduct}==”4ee2”, MODE=”0666″


Leave a Comment