'Losing connection to device during start with Android studio

I'm having problems with setting up my Mobile phone (Samsung Galaxy J5) to work as my Test-Device for flutter in android studio. I in-between managed to start my app on my phone but always lost connection after a while. Today it won't start up at all without any changes in the settings. The output in the console of android studio looks as follows

Launching lib/main.dart on SM J510FN in debug mode...
Initializing gradle...
Resolving dependencies...
Gradle task 'assembleDebug'...
Built build/app/outputs/apk/debug/app-debug.apk.
error: device '933fecf1' not found
Installing build/app/outputs/apk/app.apk...
Error: ADB exited with exit code 255
adb: error: failed to get feature set: device '933fecf1' not found

error: device '933fecf1' not found
- waiting for device -
Error launching application on SM J510FN.

I've seen the android studio losing connection to my phone while trying to install the app.apk. As the connection hasn't been steady at any point since I started getting in touch with flutter and android studio I guess there might be an issue with the adb but I have no clue how to track it down.

Flutter Doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.0.0, on Mac OS X 10.14.2 18C54, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[✓] Android Studio (version 3.3)
[✓] Connected device (1 available)

• No issues found!


Solution 1:[1]

I was able to find the solution for my problem and want to share nevertheless it seems it a little too simple: I was using a defect USB cable. Changing to a newer cable solved all connection problems immediately.. Thanks for the help anyway!

Solution 2:[2]

For me it was solved as I disabled "Use libusb backend" for "Android Debug Bridge (adb) in the settings: screenshot

Solution 3:[3]

My problem's gone (on Windows 10) after I installed google USB drivers from tools -> SDK Manager in Android Studio, turned off USB Powers saving in Control Panel -> Power Management and turned off "Allow the computer to turn off this device to save power" in all my USB-Controllers in Windows device manager.

Solution 4:[4]

This is a pretty old topic, but the problem seems to still be here. In my case after update of platform-tools (macosx). None of above, and all other advices (like manually adb kill-server, adb start-server, adb -d install... etc - didn't work)

The only way I've found - is do downgrade the platform-tools back. I've used the link like this: https://dl.google.com/android/repository/platform-tools_r28.0.0-darwin.zip But it can be reformatted to any version and any platform.. for example: https://dl.google.com/android/repository/platform-tools_r26.0.0-windows.zip

And after that, everything starts to work as before.

Solution 5:[5]

Case 1 -When I connect my device and started the flutter project run, the device automatically asks to enable debug mode even I have enabled it already. And then I press ok device disconnects and in few seconds it connects automatically.

Case 2 -When I connect my device and started the flutter project run, the device is connected and disconnect continually.

Case 3-When I connect my device and started the Native project run, the device is connected and the native project runs in the device.

I checked all most all the solutions in stack-over-flow and medium. But nothing worked for me.

But there are two solutions I have recognized.

  1. Start/Open a native project and then start/open your flutter project. then the device won't disconnect.
  2. Start/Open your flutter project if the device is disconnecting from any of the above three cases. restart the android studio and check if it is working, if not restart again...

Solution 6:[6]

I use.
Android Studio Arctic Fox | 2020.3.1 Build #AI-203.7717.56.2031.7583922, built on July 26, 2021 Runtime version: 11.0.10+0-b96-7249189 amd64 VM: OpenJDK 64-Bit Server VM by Oracle Corporation Windows 10 10.0 GC: G1 Young Generation, G1 Old Generation Memory: 1280M Cores: 20 Registry: external.system.auto.import.disabled=true Non-Bundled Plugins: com.thoughtworks.gauge, org.jetbrains.kotlin, org.intellij.plugins.markdown

I was have same problem I use Samsung Galaxy A 10. I download Android USB Driver for Windows v.1.7.43. I installed this drivers.

And problem was deasappear.

Solution 7:[7]

If your using USB cable then try with a new cable or use ADB WiFi plugin

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Martin
Solution 2 Ivan Pavlov
Solution 3 Liam Kernighan
Solution 4 Stas Pologrudov
Solution 5 Lahiru Liyanage
Solution 6 Vitalie Bancu
Solution 7 Md. Mostafizur Rahman