Eclipse Luna can not find USB devices on OS X Yosemite

Question

I am developing Android applications on my iMac with Eclipse. OS X version: Yosemite 10.10.2. Eclipse Luna often cannot find attached USB devices. Device recognition is rather hectic. Emulators sometimes disappear from the the Android Device Chooser, or can’t be seen any at all. Device settings are checked out. Developer menu is available, USB debug is enabled, KIES finds Samsung phone, HTC utilities are OK etc. Eclipse is updated to the latest version. ADB is running properly. I even added vendor IDs to the ~/.android/adb_usb.ini file. What can we do?

Solution

1. Use a quality USB cable. Recheck device settings and ADB. Note that from the latest adb versions you do NOT need to edit the ~/.android/adb_usb.ini file.

2. Run adb devices from Terminal to see if your device is recognized.

3. If not, then re-run this sequence in the Terminal:

$ adb kill-server
$ adb start-server
$ adb devices

Note: set your home PATH to include the ANDROID SDK folder when ADB is not found. Open and edit the hidden file of ~/.bash_profile with a text editor and set the PATH. For example: export PATH=${PATH}:/Users/me/android-sdk-mac_x86/platform-tools:/Users/me/android-sdk-mac_x86/tools:/Users/me/android-sdk-mac_x86/android-ndk-r10c. The file is in your home folder. In the above example this folder is /Users/me.

4. If none or not all of your devices can be seen, then try to use the following very bad looking brute-force hack. Open ~/.bash_profile and add this alias to the file: alias adb-restart=’adb kill-server;sleep 1;adb start-server;sleep 1;adb devices;sleep 1;adb devices’ Note that adb devices are added twice and sleep is inserted between commands. This hurts our feelings but we suspect that the Eclipse/ADB pair has timing difficulties to find devices and cooperate on the latest Macs. From now on you should only run adb-restart in the Terminal when devices are not recognized for debugging.

- Add the alias to the ~/.bash_profile:
alias adb-restart='adb kill-server;sleep 1;adb start-server;sleep 1;adb devices;sleep 1;adb devices'
- Reload profile and run alias in Terminal:
$ source ~/.bash_profile
$ adb-restart

5. Run the new alias adb-restart 1-3 times until all of your devices can be seen. In our practice we have never had to run it more than 3 times to find all of the attached devices. For example:

eclipse-usbdetectdevice

Click on the picture to see a larger version.

Updates:

– Eclipse seems to have made a few changes to the IDE source code, and has fixed the above mentioned error. See Eclipse Luna SR2 (4.4.2) or later versions (March 15, 2015).