代码之家  ›  专栏  ›  技术社区  ›  Abdullah Zakhoi

flutterfire尚未配置任何应用程序。检索线程信息时出错:(ipc/send)目标端口无效

  •  0
  • Abdullah Zakhoi  · 技术社区  · 5 年前

    我制作了一个新应用程序,并在Decs中执行了这些步骤,但当我运行该应用程序时,它运行正常,但在控制台上仍然有错误。

    此错误 6.26.0 - [Firebase/Core][I-COR000005] No app has been configured yet. 当我第一次在模拟器上运行应用程序时,它就会在控制台上显示,然后当我再次运行它时,它就不会显示在控制台上。

    我的控制台错误:

    Launching lib/main.dart on iPhone 11 Pro in debug mode...
    Running Xcode build...
    Xcode build done.                                           21.1s
    6.26.0 - [Firebase/Core][I-COR000005] No app has been configured yet.
    Waiting for iPhone 11 Pro to report its views...
    Debug service listening on ws://127.0.0.1:57659/LoVj1aW15Pg=/ws
    Syncing files to device iPhone 11 Pro...
    
    

    我把 FirebaseSDKVersion 在我的 podfile 这样地

    # Uncomment this line to define a global platform for your project
    platform :ios, '9.0'
    
    # Override Firebase SDK Version
    FirebaseSDKVersion = '21.1.0'
    

    我的 pub file

    version: 1.0.0+1
    
    environment:
      sdk: ">=2.7.0 <3.0.0"
    
    dependencies:
      flutter:
        sdk: flutter
      # The following adds the Cupertino Icons font to your application.
      # Use with the CupertinoIcons class for iOS style icons.
      cupertino_icons: ^0.1.3
      firebase_core: ^0.5.0
      firebase_auth: "^0.18.0+1"
    
    

    我用了同样的 StatefulWidget 我的测试代码中的文档示例。。。

    import 'package:flutter/material.dart';
    
    // Import the firebase_core plugin
    import 'package:firebase_core/firebase_core.dart';
    
    void main() {
      runApp(App());
    }
    
    class App extends StatefulWidget {
      _AppState createState() => _AppState();
    }
    
    class _AppState extends State<App> {
      // Set default `_initialized` and `_error` state to false
      bool _initialized = false;
      bool _error = false;
    
      // Define an async function to initialize FlutterFire
      void initializeFlutterFire() async {
        try {
          // Wait for Firebase to initialize and set `_initialized` state to true
          await Firebase.initializeApp();
          setState(() {
            _initialized = true;
          });
        } catch (e) {
          // Set `_error` state to true if Firebase initialization fails
          setState(() {
            _error = true;
          });
        }
      }
    
      @override
      void initState() {
        initializeFlutterFire();
        super.initState();
      }
    
      @override
      Widget build(BuildContext context) {
        // Show error message if initialization failed
        if (_error) {
          return MaterialApp(
            home: Scaffold(
              body: Center(
                child: Text('Error 1'),
              ),
            ),
          );
        }
    
        // Show a loader until FlutterFire is initialized
        if (!_initialized) {
          return MaterialApp(
            home: Scaffold(
              body: Center(
                child: Text('loading'),
              ),
            ),
          );
        }
    
        return MaterialApp(
          home: Scaffold(
            body: Center(
              child: Text(' my awesome app'),
            ),
          ),
        );
      }
    }
    
    
    0 回复  |  直到 5 年前
        1
  •  0
  •   MαπμQμαπkγVπ.0    4 年前

    我试着按照你的指示,然后第一次运行代码:

    这是我在控制台中的输出:

    Launching lib/main.dart on iPhone 11 in debug mode...
    Running Xcode build...
    Xcode build done.                                            9.5s
    Debug service listening on ws://127.0.0.1:64016/mUYWhxsVDdk=/ws
    Syncing files to device iPhone 11...
    

    没有检测到错误,并且能够在我的模拟器中显示输出:

    enter image description here

    这是我的 flutter doctor -v

    [✓] Flutter (Channel stable, 2.0.6, on macOS 11.4 20F71 darwin-x64, locale en)
        • Flutter version 2.0.6 at /Users/user/Developer/flutter
        • Framework revision 1d9032c7e1 (8 weeks ago), 2021-04-29 17:37:58 -0700
        • Engine revision 05e680e202
        • Dart version 2.12.3
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
        • Android SDK at /Users/user/Library/Android/sdk
        • Platform android-30, build-tools 30.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_242-release-1644-b3-6915495)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 12.0.1, Build version 12A7300
        • CocoaPods version 1.10.0
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 4.1)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    
    [✓] VS Code (version 1.57.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.23.0
    
    [✓] Connected device (3 available)
        • sdk gphone x86 arm (mobile) • emulator-5554                        • android-x86    • Android 11 (API 30) (emulator)
        • iPhone 11 (mobile)          • 7D4A169F-C71D-4B28-8673-4504E28E8919 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)
        • Chrome (web)                • chrome                               • web-javascript • Google Chrome 91.0.4472.114
    
    • No issues found!
    

    我使用了Flutter的最新版本。