簡體   English   中英

Flutter 應用無法在真機或模擬器上運行

[英]Flutter app can't run on real device or emulator

我是 Flutter 的新人。我在運行 flutter 項目時遇到了麻煩。

問題:

不適用於設備選擇中顯示的“main.dart”配置在此處輸入圖像描述

運行項目后,在控制台中顯示以下異常。

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.
     Required by:
         project :app
      > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.
         > Could not get resource 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/flutter_embedding_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/flutter_embedding_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
               > Connect to download.flutter.io:80 [download.flutter.io/172.217.167.144] failed: Connection timed out: connect
      > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.
         > Could not get resource 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/flutter_embedding_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/flutter_embedding_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
               > Connect to download.flutter.io:80 [download.flutter.io/172.217.167.144] failed: Connection timed out: connect
      > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.
         > Could not get resource 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/flutter_embedding_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/flutter_embedding_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
               > Connect to download.flutter.io:80 [download.flutter.io/172.217.167.144] failed: Connection timed out: connect
   > Could not resolve io.flutter:armeabi_v7a_debug:1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.
     Required by:
         project :app
      > Could not resolve io.flutter:armeabi_v7a_debug:1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.
         > Could not get resource 'http://download.flutter.io/io/flutter/armeabi_v7a_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/armeabi_v7a_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/armeabi_v7a_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/armeabi_v7a_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
               > Connect to download.flutter.io:80 [download.flutter.io/172.217.167.144] failed: Connection timed out: connect
      > Could not resolve io.flutter:armeabi_v7a_debug:1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.
         > Could not get resource 'http://download.flutter.io/io/flutter/armeabi_v7a_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/armeabi_v7a_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/armeabi_v7a_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/armeabi_v7a_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
               > Connect to download.flutter.io:80 [download.flutter.io/172.217.167.144] failed: Connection timed out: connect
      > Could not resolve io.flutter:armeabi_v7a_debug:1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.
         > Could not get resource 'http://download.flutter.io/io/flutter/armeabi_v7a_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/armeabi_v7a_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/armeabi_v7a_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/armeabi_v7a_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
               > Connect to download.flutter.io:80 [download.flutter.io/172.217.167.144] failed: Connection timed out: connect
   > Could not resolve io.flutter:x86_debug:1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.
     Required by:
         project :app
      > Could not resolve io.flutter:x86_debug:1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.
         > Could not get resource 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/x86_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/x86_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
               > Connect to download.flutter.io:80 [download.flutter.io/172.217.167.144] failed: Connection timed out: connect
      > Could not resolve io.flutter:x86_debug:1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.
         > Could not get resource 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/x86_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/x86_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
               > Connect to download.flutter.io:80 [download.flutter.io/172.217.167.144] failed: Connection timed out: connect
      > Could not resolve io.flutter:x86_debug:1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.
         > Could not get resource 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/x86_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/x86_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/x86_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
               > Connect to download.flutter.io:80 [download.flutter.io/172.217.167.144] failed: Connection timed out: connect
   > Could not resolve io.flutter:x86_64_debug:1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.
     Required by:
         project :app
      > Could not resolve io.flutter:x86_64_debug:1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.
         > Could not get resource 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/x86_64_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/x86_64_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
               > Connect to download.flutter.io:80 [download.flutter.io/172.217.167.144] failed: Connection timed out: connect
      > Could not resolve io.flutter:x86_64_debug:1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.
         > Could not get resource 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/x86_64_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/x86_64_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
               > Connect to download.flutter.io:80 [download.flutter.io/172.217.167.144] failed: Connection timed out: connect
      > Could not resolve io.flutter:x86_64_debug:1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.
         > Could not get resource 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/x86_64_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
            > Could not GET 'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119/x86_64_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.pom'.
               > Connect to download.flutter.io:80 [download.flutter.io/172.217.167.144] failed: Connection timed out: connect

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 6m 45s
Finished with error: Gradle task assembleDebug failed with exit code 1


插件為 Flutter 和 Dart 安裝了最新版本。 通過運行 flutter doctor in cmd 顯示一切正常。 這里是,

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.7, on Microsoft Windows
    [Version 10.0.18362.592], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version
    29.0.1)
[√] Android Studio (version 3.5)
[√] Connected device (1 available)

我不明白我錯在哪里。 如果你知道請幫助我。

謝謝你的幫助

嘗試重新安裝flutter的SDK。 我也遇到過同樣的問題。 然后我重新安裝了 flutter SDK,一切都很完美。

按照步驟:

  1. 轉到項目結構>項目>NOSDK
  2. 將 NOSDK 更改為最新的 ANDROID API PLATFORM
  3. 然后轉到模塊做同樣的事情

在我的例子中,我試圖執行一個集成測試,但也沒有將風格傳遞給測試命令。

此命令拋出錯誤: flutter test integration_test/app_test.dart

此命令通過: flutter test integration_test/app_test.dart --flavor qa

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM