0

On Ubuntu, adb devices rarely works. I typically have to unplug device, kill adb server, restart adb server, revoke auths on device, play around with it 500 times and eventually my device shows up.

I started on a fresh Ubuntu. I was testing React Native which didn't require gradle installed globally as it just downloads the files. adb devices would list my physical device every time. I could unplug it, plug it back in, and bam there it was. It was working good for days. It was like my nightmare was finally over.

Then I needed to do some cordova development, so I had to install cordova and gradle globally. Since then, I have to play the unplug/plug kill/start 500 times to get my device to show.

In both scenarios, I do not have android studio running (it runs it's own ADB). I have installed ADB from apt, and that's how I run it.

One thing that also happens is when I plug in the device, it shows it, it disappears, shows it as "offline" and then disappears again. See photo below.

Does this make sense to anyone? Could gradle or cordova interfere with adb?

enter image description here

Edit: I installed cordova from npm. I also sometimes encounter an issue where adb lists my device, but when I run cordova run android --device it gets stuck on the following command:

Trying to find target matching { type: 'device' }
Running adb shell command "cat /proc/cpuinfo" on target 3A060DLJG001GK...

It will just hang there and never finish.

4
  • I would check where you got Cordova, as it may have added a different version of adb which is in your shell path/environment variables from old post: Cordova and setting Android using command line. Commented Sep 8 at 21:23
  • I installed cordova from npm (npm install -g cordova). Commented Sep 8 at 21:30
  • Not sure how you normally use Gradle but Android projects I know usually provide a gradlew script that doesn't require any global Gradle version. This script doesnloads a specific grade version and uses it. Also Android Studio uses Gradle this way.
    – Robert
    Commented Sep 8 at 21:53
  • 1
    Possibly related issue ticket: cordova run android gives "Failed to execute shell command cat,/proc/cpuinfo" error #743 From the Android SDK tools directory, kill adb server, run adb server and make sure you don't have a bad cable/bad port/bad connection issue, especially if emulator connection is stable. Commented Sep 9 at 3:17

0

Browse other questions tagged or ask your own question.