Ошибка error connecting to the service

описание проблемы

Ошибка инициализации при разработке YouTube для Android. Сообщение об ошибке: ERROR_CONNECTING_TO_SERVICE. Неправильные отрисовки следующие:


Эта ошибка возникает на некоторых моделях, но не на некоторых моделях. Например, эта проблема возникает на моделях Huawei. Мы знаем, что при использовании API в собственном jar-файле YouTube для разработки YouTube должен быть установлен на устройстве, прежде чем его можно будет использовать. Это связано с тем, что для использования API требуется служба программного обеспечения YouTube. После тестирования на мобильных телефонах Huawei устройство должно сначала запустить YouTube, а затем программное обеспечение, разработанное с помощью API, может воспроизводить видео YouTube (некоторые устройства запускать не нужно, пока на устройстве YouTube все в порядке).
Я зашел на официальный сайт YouTube, чтобы найти решение, и дал это предложение
There was an error connecting to the YouTube API service.

Вдруг он потерял дар речи. Вы должны позволить пользователю открывать YouTube каждый раз перед использованием программного обеспечения, что определенно не очень хорошо.

Решение

Когда компонент YouTube инициализируется и не удается выполнить обратный вызов результата инициализации, используется второй метод воспроизведения видео.

mPlayerView.initialize(YoutubeKey, new YouTubePlayer.OnInitializedListener() {
                @Override
                public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
                    ...  
                    ...

                }

                @Override
                public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {

                    // Инициализация не удалась, попробуйте второй способ

                    }
                }
            });

Второй способ игры — использовать класс YouTubeStandalonePlayer для воспроизведения, код выглядит следующим образом:

private void playYoutubeByStandalone(String id){
        Intent intent = YouTubeStandalonePlayer.createVideoIntent(
                this, YoutubeKey, id, 0, true, false);
        if (intent != null) {
            if (canResolveIntent(intent)) {
                finish();
                startActivityForResult(intent, REQ_START_STANDALONE_PLAYER);
            } else {
                // Could not resolve the intent - must need to install or update the YouTube API service.
                YouTubeInitializationResult.SERVICE_MISSING
                        .getErrorDialog(this, REQ_RESOLVE_SERVICE_MISSING).show();
            }
        }



    }
@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == REQ_START_STANDALONE_PLAYER && resultCode != RESULT_OK) {
            YouTubeInitializationResult errorReason =
                    YouTubeStandalonePlayer.getReturnedInitializationResult(data);
            if (errorReason.isUserRecoverableError()) {
                errorReason.getErrorDialog(this, 0).show();
            } else {
                String errorMessage =
                        String.format(getString(R.string.error_player), errorReason.toString());
                Toast.makeText(this, errorMessage, Toast.LENGTH_LONG).show();
            }
        }
    }
 private boolean canResolveIntent(Intent intent) {
        List<ResolveInfo> resolveInfo = getPackageManager().queryIntentActivities(intent, 0);
        return resolveInfo != null && !resolveInfo.isEmpty();
    }

Если вы используете YouTubeStandalonePlayer для воспроизведения видео YouTube, вышеуказанные проблемы не возникнут, а если вы использовали YouTubeStandalonePlayer для воспроизведения видео YouTube, служба YouTube будет автоматически включена, а затем использовать YouTubePlayerView и YouTubePlayerFragment для инициализации воспроизведения. Проблема.

What exactly happened

Hey I went into the same problem too.
I cannot use a Emulator inside windows because my pc is a very low end pc.
So, I had to use my phone instead. It is a Samsung Galaxy J2 Pro (SM-J210F) with Android 6.0.1 (Android Marshmallow).
I used that phone to develop flutter apps regularly, but suddenly, I went to this problem.

Here’s what happened when I tried to run «Flutter Attach» in VS-Code(v1.52.0).

command

flutter attach —machine -d 420054e7960eb400

exception

StateError: Bad state: Existing VM service clients prevent DDS from taking control.

#0      DartDevelopmentService.startDartDevelopmentService (package:flutter_tools/src/base/dds.dart:83:11)
<asynchronous suspension>
#1      FlutterDevice.connect.<anonymous closure> (package:flutter_tools/src/resident_runner.dart:249:11)
<asynchronous suspension>

Fixing the issue (In Windows 10)

So, I ran these commands to fix the issue.

Fixing the Flutter SDK

flutter clean -v

flutter channel stable ** (Optional if these didn’t fix the issue)

flutter upgrade -v

flutter pub cache repair -v (Disclaimer: It will download each and every version of all the packages. Be sure to have really fast internet or give at least an hour to this.)

Configure your Proxy/VPN

If you are using a Proxy or VPN to connect to the internet,
Make sure that application isn’t resolving localhost via that.(DNS)

Kill ADB and Dart processes.

After that, kill adb and dart process on Windows.
(I don’t know exactly how to kill these in Mac/Linux. Sorry About That)
Run these commands in the Command Prompt.

taskkill /f /im dart*
taskkill /f /im adb* (You can run «adb kill-server» too)

Fixing the ADB in the Windows (*Optional).

Navigate to %HOMEDRIVE%:Users%USERNAME%.android«
In my case, It is ( C:UsersIsira Adithya.android )
Then delete adbkey.

Fixing the Android Debugging in the Android Device

Disconnect the device from the computer.
Go to Settings -> Developer Options,
Turn off USB Debugging and Turn it on again.
Revoke USB Debugging authorizations.
Restart the device.

Update Windows and Android System (If above didn’t solve the problem)

Conclusion

I think these steps should fix your problem.
Also I am still 16 years old and I am not a very experienced developer.
If these didn’t fix, use this to get more info. Github Issue

Comments

@virskor

Error connecting to the service protocol: failed to connect to http://127.0.0.1:1024/eiemy-q0vh0=/

After upgrade to lastes Flutter version.
Flutter always show this error after install and launching.
it currently not working and i can not continue to develop at present.

Steps to Reproduce

After upgrade to lastes Flutter version.
Flutter always show this error after install and launching.
it currently not working and i can not continue to develop at present.

Running Xcode build...                                                  
                                                   
 ├─Assembling Flutter resources...                          14.1s
 └─Compiling, linking and signing...                        10.2s
Xcode build done.                                           39.2s
Installing and launching...                                        29.2s
Error connecting to the service protocol: failed to connect to http://127.0.0.1:1025/jFpDvAxfurw=/

Target Platform:
Target OS version/browser:
Devices:

[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale zh-Hans)
    • Flutter version 1.12.13+hotfix.5 at /Users/virs/flutter
    • Framework revision 27321ebbad (6 天前), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/virs/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.1, Build version 11A1027
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 41.0.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[!] IntelliJ IDEA Ultimate Edition (version 2019.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[✓] VS Code (version 1.41.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.7.1

[✓] Connected device (1 available)
    • “wei zhang”的 iPhone • 029252aa59e25c34188ac565344af93858a917b1 • ios • iOS 13.1.3

! Doctor found issues in 1 category.

@virskor

tried restart system, and reinstall Flutter

@virskor

i am not using proxy or vpn

@virskor

repeat it after switch to master channel enable macOS development.

@iapicca

Hi @virskor
are you experiencing this issue with stable or master channel (or both)?
Are you located in China?
thank you

@virskor

@iapicca yes, i am in China. i found this problem still existing, and i just reopen this issue. these problem exits on both stable/master channel. Thanks

@virskor

i just upgrade to 1.12.13(hotfix5) but this problem still trouble me.

@anisalibegic

Having the same problem.

Error connecting to the service protocol: failed to connect to http://127.0.0.1:50365/UGuZ7dchAl0=/

[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.18363.535], locale bs-Latn-BA)
    • Flutter version 1.12.13+hotfix.5 at C:ProgramsFlutter
    • Framework revision 27321ebbad (6 days ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0


[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at C:UsersAnisAppDataLocalAndroidsdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 28.0.3
    • Java binary at: C:Program FilesAndroidAndroid Studiojrebinjava
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
    • All Android licenses accepted.

[√] Android Studio (version 3.5)
    • Android Studio at C:Program FilesAndroidAndroid Studio
    • Flutter plugin version 40.1.2
    • Dart plugin version 191.8423
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] IntelliJ IDEA Community Edition (version 2018.2)
    • IntelliJ at C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2018.2.2
    • Flutter plugin version 28.0.4
    • Dart plugin version 182.4323.44

[√] IntelliJ IDEA Community Edition (version 2019.3)
    • IntelliJ at C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2018.3
    • Flutter plugin version 42.1.4
    • Dart plugin version 193.5731

[√] VS Code, 64-bit edition (version 1.38.1)
    • VS Code at C:Program FilesMicrosoft VS Code
    • Flutter extension version 3.6.0

[√] Connected device (1 available)
    • ANE LX1 • 9WV4C19131006232 • android-arm64 • Android 9 (API 28)

• No issues found!

@FroseMan97

@snadon

@FroseMan97

I forgot to connect the ios application in firebase and add google json in runner)

@virskor

It works fine when you are using flutter run —release. But using flutter run will lose connection when process to installing and launching step. And this problem seems not frequently happens on wired connection. Try to open connection via network on xcode,This problem comes to trouble. But connections works well on Xcode. And flutter run —release also work well via network connection

@iapicca
iapicca

added

severe: regression

It was better in the past than it is now.

t: xcode

«xcodebuild» on iOS and general Xcode project management

tool

Affects the «flutter» command-line tool. See also t: labels.

platform-ios

iOS applications specifically.

labels

Dec 18, 2019

@kklem0

Same, Hong Kong and Oslo.

Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-GB

Works now somehow with zero code change, wonder what happened…

@Junior2401

Finally what can i do. Because i have same problem

@Xgamefactory

same here on stable latest.
flutter absolutely not working for building very annoying situation.
we have tested with example project either.

@zanderso

For those experiencing this issue, please post full logs from flutter run --verbose in a gist. Thanks!

@averyvery

I just ran into this tonight after working with Flutter for a week. Was working on a new app and trying to run on my USB-connected iOS device, but this issue began — trying to rerun older apps (ones I’d been able to run yesterday) also failed with the same error.

  • I’m on a mac, OS version 10.15.1
  • Restarting my computer doesn’t seem to have an effect.
  • I’ve attempted to run the same app on the iOS Simulator, an Android Emulator, and a USB-connected iOS device. So far, the USB-connected iOS device is the only one affected by this issue.
  • I haven’t tried uninstalling/reinstalling Flutter yet, or switching to a different version.

I’ve pasted my flutter doctor and flutter run output here: https://gist.github.com/averyvery/173ac2df50449cb2356ed91165da7140 (you have to click «view the full file» to see the run output)

The final lines are:

[+1008 ms] Forwarded port ForwardedPort HOST:1026 to DEVICE:50123
[   +5 ms] Installing and launching... (completed in 25.2s)
[   +7 ms] Connecting to service protocol: http://127.0.0.1:1026/LWSLWJ2x_Ds=/
[ +126 ms] Fail to connect to service protocol: http://127.0.0.1:1026/LWSLWJ2x_Ds=/: HttpException: , uri = http://127.0.0.1:1026/LWSLWJ2x_Ds=/ws
[   +1 ms] Error connecting to the service protocol: failed to connect to http://127.0.0.1:1026/LWSLWJ2x_Ds=/
[   +2 ms] "flutter run" took 53,306ms.

@averyvery

After some googling, I was able to resolve by going into Xcode:

  • Go to Window > Devices and Simulators
  • Find your USB-connected device
  • Uncheck «Connect via network»

Apologies if this is unrelated, or is a known issue. I got the solution from #13747 (comment)

I hadn’t changed this setting in a while, so it seems like something permanently got messed up due to the setting at some point? But removing «Connect via network» seemed to do the trick.

@beingentangled

@vysotsky

I’ve got the same issue. And the weirdest thing is that downgrading is not helping at all.

@vysotsky

Here is the log including the error:

[+1006 ms] Forwarded port ForwardedPort HOST:1024 to DEVICE:49395
[   +4 ms] Installing and launching... (completed in 25.8s)
[  +10 ms] Connecting to service protocol: http://127.0.0.1:1024/VbX8F-ZI1YQ=/
[  +46 ms] Fail to connect to service protocol: http://127.0.0.1:1024/VbX8F-ZI1YQ=/: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:1024/VbX8F-ZI1YQ=/ws
[        ] Error connecting to the service protocol: failed to connect to http://127.0.0.1:1024/VbX8F-ZI1YQ=/
[   +2 ms] "flutter run" took 66,348ms.

#0      throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
#1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:509:7)
<asynchronous suspension>
#2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:615:18)
<asynchronous suspension>
#3      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:515:33)
<asynchronous suspension>
#4      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:146:29)
#5      _rootRun (dart:async/zone.dart:1126:13)
#6      _CustomZone.run (dart:async/zone.dart:1023:19)
#7      _runZoned (dart:async/zone.dart:1518:10)
#8      runZoned (dart:async/zone.dart:1465:12)
#9      AppContext.run (package:flutter_tools/src/base/context.dart:145:18)
#10     FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:505:20)
#11     CommandRunner.runCommand (package:args/command_runner.dart:197:27)
#12     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:413:21)
<asynchronous suspension>
#13     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:146:29)
#14     _rootRun (dart:async/zone.dart:1126:13)
#15     _CustomZone.run (dart:async/zone.dart:1023:19)
#16     _runZoned (dart:async/zone.dart:1518:10)
#17     runZoned (dart:async/zone.dart:1465:12)
#18     AppContext.run (package:flutter_tools/src/base/context.dart:145:18)
#19     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:364:19)
#20     CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:112:25)
#21     new Future.sync (dart:async/future.dart:224:31)
#22     CommandRunner.run (package:args/command_runner.dart:112:14)
#23     FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:250:18)
#24     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:63:22)
#25     _rootRun (dart:async/zone.dart:1126:13)
#26     _CustomZone.run (dart:async/zone.dart:1023:19)
#27     _runZoned (dart:async/zone.dart:1518:10)
#28     runZoned (dart:async/zone.dart:1502:12)
#29     run.<anonymous closure> (package:flutter_tools/runner.dart:61:18)
<asynchronous suspension>
#30     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:146:29)
#31     _rootRun (dart:async/zone.dart:1126:13)
#32     _CustomZone.run (dart:async/zone.dart:1023:19)
#33     _runZoned (dart:async/zone.dart:1518:10)
#34     runZoned (dart:async/zone.dart:1465:12)
#35     AppContext.run (package:flutter_tools/src/base/context.dart:145:18)
#36     runInContext (package:flutter_tools/src/context_runner.dart:64:24)
#37     run (package:flutter_tools/runner.dart:50:10)
#38     main (package:flutter_tools/executable.dart:65:9)
#39     main (file:///Users/user/Library/flutter/packages/flutter_tools/bin/flutter_tools.dart:8:3)
#40     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:305:32)
#41     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)

Flutter doctor output:

[✓] Flutter (Channel unknown, v1.12.9, on Mac OS X 10.15.1 19B88, locale en-UA)
    • Flutter version 1.12.9 at /Users/user/Library/flutter
    • Framework revision 33d302240d (4 weeks ago), 2019-11-22 12:28:33 -0500
    • Engine revision 9f4341a2b8
    • Dart version 2.7.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
    • Android SDK at /Users/user/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3, Build version 11C29
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 42.1.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.36.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.2.0

[✓] Connected device (1 available)
    • iPad • 862bb3080e5401d439b90384817f5710f32#### • ios • iOS 13.3

• No issues found!

UPD: just changed channel to Master (Channel master, v1.13.6-pre.16) and it did not help.
Rebooting both Mac and iPad also doesn’t seem to be helpful.

@jallynme

@Xgamefactory

my error was disappeared after some edits. still not sure what was the fix.
you can try to edit android/build.gradle especially dowgrading your gradle version.
also i have removed preferences package from pubspec it is using old version of shared_preferences.
my versions.

classpath 'com.android.tools.build:gradle:3.3.2'
 classpath 'com.google.gms:google-services:4.3.3'

@ortizen

@beingentangled

How many with this problem using this package?
dependencies:
flutter_clean_architecture: ^2.0.1

@beingentangled

I’ve got a solution to my problem.

Please check the following:
If the app has any permissions, make sure to give it in both Android Manifest and Info.plist.
In my case, I was requesting a location at the start of the application whose permission was not defined for IOS in Info.plist which when requested at the starting will result in a crash and will not allow to connect the observatory throwing the error:

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

Please make sure to give the necessary permissions in both IOS and Android.
Thanks.

@HaoCherHong

Solved by disabling personal hotspot on device

@DerSIlent

I copied all my plugins to a new project and narrowed it down to flutter_facebook_plugin giving the error, once removed it started to run on device again. Hope this helps!

@ortizen

I copied all my plugins to a new project and narrowed it down to flutter_facebook_plugin giving the error, once removed it started to run on device again. Hope this helps!
Yeap, I tried @DerSIlent solution to nuke facebook plug in and solved the problem.

@bastibense

I had the same issue (iOS on iPad).For me it seems that it had to do with DNS settings (I had 8.8.8.8 set up as my DNS, overriding my router’s default DHCP settings).

After setting DNS in system settings it to «Automatic» apparently solved the problem for me.

@AnoRebel

Also had the same issue, solved it by removing the package barcode_scan

@30in2020

I also had the same issue, and solved it by using FlutterActivity instead of FlutterFragmentActivity.

@iKK001

I finally found that flutter upgrade and a flutter clean did help.

@gabrielnemeth

For me it was wrongly configured facebook login. Precisely missing string.xml and AndroidManifest.xml data:

/android/app/src/main/res/values/strings.xml

<resources>
    <string name="app_name">Your App Name here.</string>

    <!-- Replace "000000000000" with your Facebook App ID here. -->
    <string name="facebook_app_id">000000000000</string>

    <!--
      Replace "000000000000" with your Facebook App ID here.
      **NOTE**: The scheme needs to start with `fb` and then your ID.
    -->
    <string name="fb_login_protocol_scheme">fb000000000000</string>
</resources>

/android/app/src/main/AndroidManifest.xml

<meta-data android:name="com.facebook.sdk.ApplicationId"
    android:value="@string/facebook_app_id"/>

<activity android:name="com.facebook.FacebookActivity"
    android:configChanges=
            "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
    android:label="@string/app_name" />

<activity
    android:name="com.facebook.CustomTabActivity"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="@string/fb_login_protocol_scheme" />
    </intent-filter>
</activity>

The full guide: https://firebase.google.com/docs/auth/android/facebook-login

@mdrideout

I was having this issue. I uninstalled the app from my device, opened the project in xcode, ran some build cleaning thing that appeared in the yellow triangle warning area, then built the app via xcode. Then uninstalled the app from device again. Then ran via android studio and it worked.

@iKK001

Incredible, @mdrideout, your workaround helped indeed ! The cleaning in Xcode and uninstall/install trick did help. Thank you very much.

@luckymehndiratta

@senk

Same here, worked once after that service protocol error, Cambodia, Stable

@ChristBKK

I copied all my plugins to a new project and narrowed it down to flutter_facebook_plugin giving the error, once removed it started to run on device again. Hope this helps!

this one worked. Crazy.
For me it was also the Facebook Login Plugin

@GilDev

Same problem here, using adb connected over WiFi.

@DerSIlent

I would also like to mention that I got the same error when I had the emulator turned off. It started working again when I clicked the power button on the side of emulator.

@zanderso

@blasten

I was able to reproduce this issue by using an emulator running Android 10.

[        ] Forwarded host port 61900 to device port 38717 for Observatory
[  +18 ms] Connecting to service protocol: http://127.0.0.1:61900/Zjn5H-sLOgo=/
[  +98 ms] Fail to connect to service protocol: http://127.0.0.1:61900/Zjn5H-sLOgo=/: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:61900/Zjn5H-sLOgo=/ws
[        ] Error connecting to the service protocol: failed to connect to http://127.0.0.1:61900/Zjn5H-sLOgo=/
[   +5 ms] "flutter run" took 4,699ms.

@blasten

I was able to fix the issue by updating system image to revision 8. This can be done by going to Preferences -> System Settings -> Android SDK -> SDK Platforms.

If you hitting this issue, it’s likely that you are using an older system image and facing https://issuetracker.google.com/issues/132325318. Please provide more details otherwise.

@blasten

If you hitting this issue, it’s likely that you are using an older system image and facing https://issuetracker.google.com/issues/132325318. Please provide more details otherwise.

I’m closing this issue since the solution is to update the system image. Please reopen and provide more details if you experiment the same issue.

@indigothm

I’m closing this issue since the solution is to update the system image. Please reopen and provide more details if you experiment the same issue.

That wouldn’t solve it on iOS though.

@zanderso

@indigothm This scope of this issue has crept a bit. I think we should leave this one closed, and if folks are still seeing this, please open new separate Android and/or iOS issues. Thanks!

@DjangoOverloard

I do have the same problem on IOS, not sure if it’s related to changes in any of my plugins. However, I can run app perfectly from Xcode, with all the logs being available.

@vguardiola

I had the same issue, I remove the flutter_facebook_login from my pubspec and the app works fine.

Regards

@flutter
flutter

locked as resolved and limited conversation to collaborators

Jan 15, 2020

Labels

platform-ios

iOS applications specifically.

severe: regression

It was better in the past than it is now.

t: xcode

«xcodebuild» on iOS and general Xcode project management

tool

Affects the «flutter» command-line tool. See also t: labels.

waiting for customer response

The Flutter team cannot make further progress on this issue until the original reporter responds.

У меня такая же проблема.
Думаю, это из-за твоих дротиков и флаттеров.

Just run flutter upgrade and flutter clean to solve the problem.

Аналогичные решения проблемы здесь: https://github.com/flutter/flutter/issues/47204

Это мне помогло. Вот журнал:

PS D:DocumentsWorkbus_stop_routes> flutter clean
Deleting build...                                                  629ms
Deleting .dart_tool...                                             567ms
Deleting .packages...                                                0ms
Deleting Generated.xcconfig...                                       0ms
Deleting flutter_export_environment.sh...                            0ms
Deleting .flutter-plugins-dependencies...                            0ms
Deleting .flutter-plugins...                                         0ms
PS D:DocumentsWorkbus_stop_routes> flutter pub get
Running "flutter pub get" in bus_stop_routes...                     3.4s
PS D:DocumentsWorkbus_stop_routes> flutter run
Launching libmain.dart on SM N910H in debug mode...
Note: C:flutter.pub-cachehostedpub.dartlang.orggoogle_maps_flutter-2.0.1androidsrcmainjavaioflutterpluginsgooglemapsConvert.java uses or overrides a deprecated API.
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                        46.3s
√ Built buildappoutputsflutter-apkapp-debug.apk.
Installing buildappoutputsflutter-apkapp.apk...                29.0s
Activating Dart DevTools...                                         3.1s
Error connecting to the service protocol: failed to connect to http://127.0.0.1:58851/a7SAG7gM8aI=/
PS D:DocumentsWorkbus_stop_routes> dart upgrade
Could not find a command named "upgrade".

Usage: dart [<vm-flags>] <command|dart-file> [<arguments>]

Global options:
-h, --help                 Print this usage information.
-v, --verbose              Show additional command output.
    --version              Print the Dart SDK version.
    --enable-analytics     Enable anonymous analytics.
    --disable-analytics    Disable anonymous analytics.

Available commands:
  analyze   Analyze the projects Dart code.
  compile   Compile Dart to various formats.
  create    Create a new project.
  fix       Apply automated fixes to Dart source code.
  format    Idiomatically format Dart source code.
  migrate   Perform a null safety migration on a project or package.
  pub       Work with packages.
  run       Run a Dart program.
  test      Run tests in this package.

Run "dart help <command>" for more information about a command.
See https://dart.dev/tools/dart-tool for detailed documentation.
PS D:DocumentsWorkbus_stop_routes> flutter upgrade
Upgrading Flutter to 2.0.4 from 2.0.3 in C:flutter...
Checking Dart SDK version... 
Downloading Dart SDK from Flutter engine 2dce47073a378673f6ca095e91b8065544c3a881...       
Building flutter tool... 
Running pub upgrade... 

Upgrading engine...
Downloading android-arm-profile/windows-x64 tools...               20.1s
Downloading android-arm-release/windows-x64 tools...                8.7s
Downloading android-arm64-profile/windows-x64 tools...              9.7s
Downloading android-arm64-release/windows-x64 tools...              8.2s
Downloading android-x64-profile/windows-x64 tools...                9.3s
Downloading android-x64-release/windows-x64 tools...                7.9s
Downloading android-x86 tools...                                   98.3s
Downloading android-x64 tools...                                   64.8s
Downloading android-arm tools...                                   15.6s
Downloading android-arm-release tools...                           12.4s
Downloading android-arm64 tools...                                 36.2s
Downloading android-arm64-profile tools...                         18.1s
Downloading android-arm64-release tools...                         14.6s
Downloading android-x64-profile tools...                           19.0s
Downloading android-x64-release tools...                           15.0s
Downloading android-x86-jit-release tools...                       21.6s
Downloading Web SDK...                                             42.0s

Flutter 2.0.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b1395592de (7 days ago) • 2021-04-01 14:25:01 -0700
Engine • revision 2dce47073a
Tools • Dart 2.12.2

Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.4, on Microsoft Windows [Version 10.0.19042.867], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] VS Code (version 1.55.0)
[√] Connected device (3 available)

• No issues found!
PS D:DocumentsWorkbus_stop_routes> flutter run
Running "flutter pub get" in bus_stop_routes...                  1,114ms
Launching libmain.dart on SM N910H in debug mode...
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                       107.2s
√ Built buildappoutputsflutter-apkapp-debug.apk.
Installing buildappoutputsflutter-apkapp.apk...                29.2s
Syncing files to device SM N910H...                                141ms

Flutter run key commands.
r Hot reload.
R Hot restart.
h Repeat this help message.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
An Observatory debugger and profiler on SM N910H is available at:
http://127.0.0.1:60828/axOQuzsu83M=/

Если не решено, это связано с расширением, которое вы используете.

  • После этого, пожалуйста, снова откройте свой редактор. Но иногда это не работает, когда вы используете расширения.

  • Еще я проверил антивирусный защитник. И дал разрешение.

enter image description here

Solution 1:[1]

If you return to a previous version of android, (Android Pie), you will no longer have this problem, it is related only to the latest versions of android (Q, 29), in others you will no longer have the problem.

Solution 2:[2]

A quick restart of the phone worked for me

Solution 3:[3]

What exactly happened

Hey I went into the same problem too.
I cannot use a Emulator inside windows because my pc is a very low end pc.
So, I had to use my phone instead. It is a Samsung Galaxy J2 Pro (SM-J210F) with Android 6.0.1 (Android Marshmallow).
I used that phone to develop flutter apps regularly, but suddenly, I went to this problem.

Here’s what happened when I tried to run «Flutter Attach» in VS-Code(v1.52.0).

command

flutter attach —machine -d 420054e7960eb400

exception

StateError: Bad state: Existing VM service clients prevent DDS from taking control.

#0      DartDevelopmentService.startDartDevelopmentService (package:flutter_tools/src/base/dds.dart:83:11)
<asynchronous suspension>
#1      FlutterDevice.connect.<anonymous closure> (package:flutter_tools/src/resident_runner.dart:249:11)
<asynchronous suspension>

Fixing the issue (In Windows 10)

So, I ran these commands to fix the issue.

Fixing the Flutter SDK

flutter clean -v

flutter channel stable ** (Optional if these didn’t fix the issue)

flutter upgrade -v

flutter pub cache repair -v (Disclaimer: It will download each and every version of all the packages. Be sure to have really fast internet or give at least an hour to this.)

Configure your Proxy/VPN

If you are using a Proxy or VPN to connect to the internet,
Make sure that application isn’t resolving localhost via that.(DNS)

Kill ADB and Dart processes.

After that, kill adb and dart process on Windows.
(I don’t know exactly how to kill these in Mac/Linux. Sorry About That)
Run these commands in the Command Prompt.

taskkill /f /im dart*
taskkill /f /im adb* (You can run «adb kill-server» too)

Fixing the ADB in the Windows (*Optional).

Navigate to %HOMEDRIVE%:Users%USERNAME%.android«
In my case, It is ( C:UsersIsira Adithya.android )
Then delete adbkey.

Fixing the Android Debugging in the Android Device

Disconnect the device from the computer.
Go to Settings -> Developer Options,
Turn off USB Debugging and Turn it on again.
Revoke USB Debugging authorizations.
Restart the device.

Update Windows and Android System (If above didn’t solve the problem)

Conclusion

I think these steps should fix your problem.
Also I am still 16 years old and I am not a very experienced developer.
If these didn’t fix, use this to get more info. Github Issue

Solution 4:[4]

Uninstall app in Emulator fixed same issue for me

Solution 5:[5]

Solution 6:[6]

Try

flutter run —release

I faced the same issue after upgrading flutter 1.13 but the above command helped.

Solution 7:[7]

For my case, I met the error when I used 3rd parties such as facebook_login, twitter_login incorrectly.

To check:

  • comment the libs from pubspec.yaml, corresponding code as well.

To fix:

  • update correctly config for the 3rd parties.

Hope this help.

Solution 8:[8]

I had a simliar problem with ios with the error message Error connecting to the service protocol: failed to connect to http://127.0.0.1:....... I solved it by removing the app from the simulator and ran a clean in xcode, then it could build successfully from vs code!

Solution 9:[9]

For me it was caused by flutter_facebook_login plugin causing issue i removed it and i could afford to remove facebook login option but in your case you can try different version of flutter_facebook_login or you can use different plugin for loggin in using facebook.

Solution 10:[10]

In virtual device manager, try one of these options.

Wipe Data
Cold Boot Now

enter image description here

Solution 11:[11]

Try

flutter doctor -v

I had faced same issue. So I run flutter doctor -v command.

Then I found the error

? Android licenses not accepted. To resolve this, run: flutter doctor —android-licenses.

flutter doctor —android-licenses this command resolved my issue.

Solution 12:[12]

I had faced the same issue but the only thing which solved my problem is to uninstall the app on my physical phone and I again try to run. and truly its work.

Solution 13:[13]

I solved this problem by:

  • turn off my phone.
  • disconnect.
  • turn on my phone.

By doing this, you will restart the VM Service.

Solution 14:[14]

check if you have enough storage in your phone.

I had the same problem and that was the reason.

Solution 15:[15]

It seems it can be different things. In my case, I removed a package I was using, barcode_scan.

Solution 16:[16]

I have the same problem and I go to xcode -> window -> device & simulator, under Installed Apps I remove some apps and it works.

Solution 17:[17]

Open the project in android studio => Start your Emulator — OR — Connect your android device with Debug mode «on» => Run the Project on android studio => Run your project from VS code or from command line using flutter run

Solution 18:[18]

When I deleted the emulator in AVD Manager and rebuilt it, it worked.

Solution 19:[19]

For me, it was caused by phone screen saver. Emulator screen was locked. After
I pressed on power icon, the screen opened. then I run it again and everything is working.

Solution 20:[20]

I have resolved this problem after add some code in android folder.

1.Add below code in AndroidManifest.xml

 <meta-data android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/facebook_app_id"/>

    <activity android:name="com.facebook.FacebookActivity"
        android:configChanges=
            "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name" />
    <activity
        android:name="com.facebook.CustomTabActivity"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="@string/fb_login_protocol_scheme" />
        </intent-filter>
    </activity>

2.Add your Facebook app id in strings.xml

<string name="facebook_app_id">380000000000000</string>
<string name="fb_login_protocol_scheme">fb380000000000000</string>

3.Add dependencies in pubspec.yaml

flutter_facebook_login: ^1.1.1

Pub get and run.

Solution 21:[21]

In my case, I just closed the simulator, and ran it again.

Solution 22:[22]

I was having the same error message. In my case, the problem was just a configuration that I changed in Runner.xcodeproj.

Open runner.xcodeproj in Xcode, go to the General tab -> App Icons and Lauch Images -> «Launch Screen File». I had changed it to Main and that cause the error, changing back to «LaunchScreen» option solved the problem for me.

Solution 23:[23]

This happened to me too, the problem was I was using a vpn in my PC, I turned the vpn off, and everything just worked fine

Solution 24:[24]

If you are using Flutter 2.10 or higher it may be that you tried to emulate a Windows desktop app but you don’t have Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.0) installed.

Apparently, it won’t let you emulate anything until you install VS.
Run flutter doctor to find out.

Solution 25:[25]

Open AVD from Android Studio and clear data of emulator and re-run again.
it worked for me.

Возможно, вам также будет интересно:

  • Ошибка error connect to mysql
  • Ошибка error 4205 generic в игре mafia
  • Ошибка error 404 что это значит
  • Ошибка error 403 permission denied
  • Ошибка error 4 на домофоне eltis

  • Понравилась статья? Поделить с друзьями:
    0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии