leoh
leoh

Reputation: 10608

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

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)

Upvotes: 2

Views: 8348

Answers (8)

Quick learner
Quick learner

Reputation: 11457

Try these steps

  1. Get in terminal
  2. Command: lsof -nP -i4TCP:1024

This command will return:

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME mobiledev 18230 mauro 7u IPv4 0xbea54bcdd5cea723 0t0 TCP 127.0.0.1:1024 (LISTEN)

  1. Kill the mobiledev with the command kill 18230 (the number PID from the process)

  2. Hit the F5/CtrlF5 or Start Debugging/Start Without Debuggin on VS Code or Android Studio

  3. You have it working perfectly with hot reload, debug tools (breakpoints, watch variables, etc) and DevTools.

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

Upvotes: 0

Fakhar Ilyas
Fakhar Ilyas

Reputation: 127

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

Upvotes: 0

Aziz
Aziz

Reputation: 479

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.

Upvotes: 0

Kamran Rasheed
Kamran Rasheed

Reputation: 1

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

Upvotes: 0

Ishak Hari
Ishak Hari

Reputation: 188

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

Upvotes: 1

Rifat Hossain
Rifat Hossain

Reputation: 97

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>

Upvotes: 0

Norberto
Norberto

Reputation: 1

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

Upvotes: 0

leoh
leoh

Reputation: 10608

  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.

Upvotes: 2

Related Questions