代码之家  ›  专栏  ›  技术社区  ›  RED.Skull

Flutter应用程序未在Windows中的Android模拟器中运行

  •  0
  • RED.Skull  · 技术社区  · 4 年前

    我第一次尝试在Android模拟器中运行我的flutter应用程序。不幸的是,我面临着这个问题。

    颤振日志

    Flutter crash report.
    Please report a bug at https://github.com/flutter/flutter/issues.
    
    ## command
    
    flutter run -d emulator-5554 -v
    
    ## exception
    
    ArgumentError: Invalid argument(s): Cannot find executable for C:\Users\user\Desktop\NewFlutterApp\android\gradlew.bat.
    
    
    #0      _getExecutable (package:process/src/interface/local_process_manager.dart:127:5)
    #1      LocalProcessManager.start (package:process/src/interface/local_process_manager.dart:43:30)
    #2      _DefaultProcessUtils.start (package:flutter_tools/src/base/process.dart:462:28)
    #3      _DefaultProcessUtils.stream (package:flutter_tools/src/base/process.dart:480:35)
    #4      buildGradleApp (package:flutter_tools/src/android/gradle.dart:388:35)
    #5      _AndroidBuilderImpl.buildApk (package:flutter_tools/src/android/android_builder.dart:103:13)
    #6      AndroidDevice.startApp (package:flutter_tools/src/android/android_device.dart:540:28)
    #7      _rootRunUnary (dart:async/zone.dart:1198:47)
    #8      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
    #9      _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
    #10     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
    #11     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
    #12     Future._completeWithValue (dart:async/future_impl.dart:529:5)
    #13     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
    #14     _rootRun (dart:async/zone.dart:1190:13)
    #15     _CustomZone.run (dart:async/zone.dart:1093:19)
    #16     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
    #17     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
    #18     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
    #19     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
    #20     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
    #21     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)
    
    
    ** ## flutter doctor **
    
    
    [✓] Flutter (Channel beta, 1.19.0-4.3.pre, on Microsoft Windows [Version 10.0.14393], locale en-US)
        • Flutter version 1.19.0-4.3.pre at C:\Users\user\Documents\flutter
        • Framework revision 8fe7655ed2 (12 days ago), 2020-07-01 14:31:18 -0700
        • Engine revision 9a28c3bcf4
        • Dart version 2.9.0 (build 2.9.0-14.1.beta)
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
        • Android SDK at C:\Users\user\AppData\Local\Android\Sdk
        • Platform android-30, build-tools 30.0.1
        • ANDROID_HOME = C:\Users\user\AppData\Local\Android\Sdk
        • Java binary at: C:\Users\user\Desktop\AndroidStudio\jre\bin\java
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
        • All Android licenses accepted.
    
    [✓] Chrome - develop for the web
        • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
    
    [✓] Android Studio (version 4.0)
        • Android Studio at C:\Users\user\Desktop\AndroidStudio
        • Flutter plugin version 47.1.2
        • Dart plugin version 193.7361
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    
    [✓] VS Code (version 1.46.1)
        • VS Code at C:\Users\user\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.12.2
    
    [✓] Connected device (3 available)
        • AOSP on IA Emulator • emulator-5554 • android-x86    • Android 9 (API 28) (emulator)
        • Web Server          • web-server    • web-javascript • Flutter Tools
        • Chrome              • chrome        • web-javascript • Google Chrome 83.0.4103.116
    
    • No issues found!
    

    我在flutter医生那里看不到任何问题,我需要flutter社区的帮助。谢谢

    0 回复  |  直到 4 年前
        1
  •  0
  •   Robert de W    4 年前

    gradle.bat 在里面 C:\Users\user\Desktop\NewFlutterApp\android\ 它似乎不见了。

    尝试 flutter create . 在根目录中。

        2
  •  0
  •   RED.Skull    4 年前

    此问题的实际解决方案:

    1. 防病毒软件阻止sdkmanager.bat文件-在防病毒设置中添加异常
    2. 快跑 flutter create . 在安卓系统中安装gradle.bat。