Flutter iOS device: Error connecting to the service protocol: failed to connect to http://127.0.0.1:1024

Viewed 4418

Problem when connect to real iOS device using Flutter in Android Studio.

"Error connecting to the service protocol: failed to connect to http://127.0.0.1:1024"

Searched up and restart the device, switch to master channel seems not helping.

flutter doctor shows

[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.3 19D76,
    locale en-US) 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.4)
[✓] Android Studio (version 3.6)
[✓] Connected device (1 available)
8 Answers
  1. open ios/Runner.xcworkspace/, clean build dir

enter image description here

  1. I also restarted the phone, but not sure if that's necessary.

just uninstall your already installed apk and build it again thats how i solved my error on android device

Try these steps

 1) Get in terminal
   2) Command: "lsof -nP -i4TCP:1024"
   3) This command will return:
   4) COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
    mobiledev 18230 mauro 7u IPv4 0xbea54bcdd5cea723 0t0 TCP 127.0.0.1:1024 (LISTEN)
   5) Kill the mobiledev with the command "kill 18230" (the number PID from the process)
   6) Hit the F5/Ctrl-F5 or Start Debugging/Start Without Debuggin on VS Code or Android Studio
   7) You have it working perfectly with hot reload, debug tools (breakpoints, watch variables, etc) and DevTools.

Reference https://github.com/flutter/flutter/issues/32651

Thanks for the input:

  1. I did what you indicated (in xcode).
  2. Later, I disconnected the device.
  3. Again, I run the application in the terminal.

Terminal Results

I also have faced the same error. In my case, the issue was I have pointed to a wrong source for the image to be shown in the splash screen in the XML file.

    <?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@android:color/white" />
    <!-- You can insert your own image assets here -->
     <item>
        <bitmap
            android:gravity="center"
            android:src="@drawable/ic_launcher_round" />
    </item> 
</layer-list>

I had the same problem, i solved it by disconnecting my phone from the Wifi

I was facing the same problem, I changed my channel to dev and also ran the following commands and it solved it:

1: pod install

2: pod repo update

3: sudo gem install cocoapods

4: pod setup

I had this issue on my physical Android device on Mac, but performing complete restart to my Mac had solved the problem.
N.B: Disabling VPN - if you use one - may helps to solve the issue.

Related