Friday, February 21, 2014

Transfer Files from Android and Linux with ADB and AAFM

If you are currently using Linux on the desktop and looking for a way to transfer files from your Android device, continue reading this post.  A female developer named Sole created a GTK program called AAFM.  It stands for Android ADB File Manager.  What this program does is causes the File Manager to display on the screen and communicate with ADB, after the Android device is plugged into a Linux PC's USB slot and a Python command to call the File Manager is executed on the terminal.

For this example, I am using Linux Mint 14 and a Samsung Stellar Smartphone with Android 4.1.2.  I followed the instructions from Sole's site and added additional steps to make the process more automated once the Smartphone is plugged into the USB slot.

1.  Clone Sole's repository.

2.  Download the Android SDK zip file from this link: (zip file will be found in Downloads folder)

3.  Extract the Android SDK zip file to the Applications folder (created when you cloned Sole's repository.)  

     You can perform the extraction one of 2 ways:
a.  Using your mouse - Right click on the zip file, select "Extract to" and select the "Applications" folder within your Home directory.

b.  Using the terminal command line -  Bring up the Terminal Emulator by finding it on the Menu of your Linux distribution or using <CTRL><ALT><T>.

Type the command unzip -d destination_folder_path with the path relative to where the Applications directory is located for the destination_folder_path and hit ENTER.

4.  Test ADB to make sure it's installed correctly. - Bring up the terminal again and type "adb" and hit ENTER.  It should display the Android Debug Bridge Version and a list of ADB command references.

5.  Display the Vendor ID of your Android device for the next step. - Bring up the terminal and type "lsusb" and hit ENTER.  (It should be the four digit number next to the word "ID" on the same line as the name of your Android device.)

6.  Configure udev rules to allow Linux to access your Android device.
     a.  Navigate to /etc/udev/rules.d directory and click the file that says "android.rules".
   b.  Enter the Vendor ID that you found in Step 5 like this SYSFS{idVendor}==”04e8″.  Add the entire line in the screenshot to the android.rules file and save it.

7.  Change file permissions on udev rules.  Type the command on the screen below and hit ENTER.

8.  Enable Debug mode on your Android device.  Go to Developer Options and make sure it's on.  Check the box for USB debugging.

9.  Test the Configuration udev rule with your Android device.  Type "adb devices" and hit ENTER.

10.  Execute AAFM in command mode.  Type the command on the screen below and hit ENTER.  (Make sure you replace my name in the command with your name.)
After python command is executed, the terminal window will display the following and the Android ADB File Manager will pop up.

To Display File Manager without executing step 10 after plugging Android device into USB:

11.  Create a shell script and name it Pythonadb.  Go into Gedit and type "#! /bin/bash" on the first line of the editor and click File|Save as "Pythonadb".

12.  Store the command in step 10 in the Pythonadb shell script.

13.  Make sure the Pythonadb shell script is executable.

14.  Copy or move the Pythonadb shell script from the current directory to /usr/bin directory.

15.  On the Linux Mint Menu, Navigate to Settings|Removable Drives and Media and add the following on the command line for Audio CD's and Portable Music Players:
16.  When you plug in your Smartphone cord to your USB, it will look like this.

Once the File Manager is displayed you can locate your Android files on the right pane of the Window and simply drag and drop them to your Linux desktop.

Here is the video I created to accompany the instructions so you can follow along more easily:

NOTE:  On Linux Mint 16 (Petra), my Samsung Stellar is able to work with the Linux Mint File Manager (Nautilus) to transfer Android files.  I just put my Samsung Stellar into Developer Mode and checked on USB Debugging and plugged it into the USB and it worked out of the box. 


  1. Using my Samsung Galaxy Young gt-s6310n with ArchLinux x64 pc. This app is wonderfull for writing to internal storage but I have a problem, I cannot write any data to external sd card. I can read and view but cant create directory, rename files or so.

    Maybe it has something to do with permission WRITE_MEDIA_STORAGE?

  2. Juan, thanks for bringing up this issue. In my tutorial, I never demonstrated transferring files from my Linux desktop to my Android smartphone's external sd card. It didn't work due to the default permissions set for external storage. My phone is a Samsung Stellar and I'm on Android 4.1.2. I believe your issue is the same as mine, having to do with the default permissions set for external storage on your phone. In order to grant the required permission, you will have to root your phone and change a file called platform.xml according to the instructions at this link:

    I, myself, wouldn't want to take the risk of bricking my phone by rooting it without having a backup phone so all I can do is advise you to try it at your own risk.

    BTW, I get a ":permission denied" error message when I execute this command at the terminal: "adb push "/home/maricelle/Desktop/CloudfareInstructions.pdf" mnt/extSdCard/Download".


Search This Blog