I have a flutter app that I debug on real device, and it runs fine in the debug mode.
I got to a point when I created a backend server that runs in a localhost:8080
only machine, so in order to make it accessible from my real phone device also, I ran:
adb reverse tcp:8080 tcp:8080
and it worked exactly as I expected where the app was running.
But, after this, if I re-rerun the app again in the real device ( unplug and plug again the USB in the machine ), it got to the point of showing the √ Built build\app\outputs\flutter-apk\app-debug.apk.
and this error got thrown and it terminate/close the debug process of the app :
Error connecting to the service protocol: failed to connect to http://127.0.0.1:61410/DHX5GEb2kn4=/
I did try to kill the adb.exe command with:
adb kill-server
supposing that this will undo the adb reverse
command but the same error gets thrown
well, I found a painful fix, which is restarting the device, but this takes much time and is painful.
I want to know what should I turn on/off while debugging my flutter app
I finally managed to fic the issue, and get my app debugging properly again.
What I did wrong ?
When I needed the
adb
, I thought it's not installed on my laptop since when I runnedadb
command in command line tool (cmd), it tells me that it's not recognized, so the smart me did downloaded the android platforms-tools separatly from Here , and I runned the :from it's folder, which runned, and I thought I solved the issue, but what I just learned is that the Dart VM server uses an internal installed another
adb.exe
which have a different version (39) that what I run the command with (41).so when I re-debug the flutter project, the error happens.
How did I fix it?
I did simply searched for the internal
adb.exe
, you can find in theAndroid
folder,...\Android\SDK\platforms\tools\adb.exe
.I Paste the new
adb.exe
with the height version inside the folder.Run the command from that folder
For 3., you can set the path of that folder in the
PATH
in environment variables, so you can run theadb
commands from anywhere.