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?
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.
adb
which is in your shell path/environment variables from old post: Cordova and setting Android using command line.