VsCode的调试模式不再通过AVD或真实的android设备启动应用程序。直到昨天以前,两者都可以完美工作。
我遇到错误
在调试模式下为x86构建的Android SDK上启动lib \ main.dart ...
Gradle任务assembleDebug失败,退出代码为1
已退出(sigterm)
我跑了扑医生-v
[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [version 10.0.17134.523], locale fr-FR)
• Flutter version 1.0.0 at F:\flutter_src
• Framework revision 5391447fae (6 weeks ago), 2018-11-29 19:41:26 -0800
• Engine revision 7375a0f414
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
• Android SDK at F:\Android_sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = F:\Android_sdk
• Java binary at: F:\Android_src\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
• All Android licenses accepted.
[√] Android Studio (version 3.2)
• Android Studio at F:\Android_src
• Flutter plugin version 31.3.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)
我不得不说我绝对不知道出了什么问题。
我认为这与代码无关,是否对我的项目没有造成重大影响。除了调试控制台中的错误之外,它没有让我有其他事情。
Flutter运行-v
[ +128 ms] executing: [F:\flutter_src\] git rev-parse --abbrev-ref --symbolic @{u}
[ +245 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/stable
[ ] executing: [F:\flutter_src\] git rev-parse --abbrev-ref HEAD
[ +73 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ +2 ms] stable
[ ] executing: [F:\flutter_src\] git ls-remote --get-url origin
[ +88 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ ] executing: [F:\flutter_src\] git log -n 1 --pretty=format:%H
[ +99 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[ ] 5391447fae6209bb21a89e6a5a6583cac1af9b4b
[ ] executing: [F:\flutter_src\] git log -n 1 --pretty=format:%ar
[ +80 ms] Exit code 0 from: git log -n 1 --pretty=format:%ar
[ ] 6 weeks ago
[ +1 ms] executing: [F:\flutter_src\] git describe --match v*.*.* --first-parent --long --tags
[ +253 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[ ] v1.0.0-0-g5391447fa
[ +308 ms] executing: F:\Android_sdk\platform-tools\adb devices -l
[+4275 ms] Exit code 0 from: F:\Android_sdk\platform-tools\adb devices -l
[ ] List of devices attached
[ +19 ms] No connected devices.
[ +20 ms] "flutter run" took 4 413ms.
#0 throwToolExit (package:flutter_tools/src/base/common.dart:26:3)
#1 RunCommand.validateCommand (package:flutter_tools/src/commands/run.dart:249:7)
<asynchronous suspension>
#2 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:379:11)
<asynchronous suspension>
#3 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:335:33)
<asynchronous suspension>
#4 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:142:29)
<asynchronous suspension>
#5 _rootRun (dart:async/zone.dart:1124:13)
#6 _CustomZone.run (dart:async/zone.dart:1021:19)
#7 _runZoned (dart:async/zone.dart:1516:10)
#8 runZoned (dart:async/zone.dart:1463:12)
#9 AppContext.run (package:flutter_tools/src/base/context.dart:141:18)
<asynchronous suspension>
#10 FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:326:20)
#11 CommandRunner.runCommand (package:args/command_runner.dart:196:27)
<asynchronous suspension>
#12 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:401:21)
<asynchronous suspension>
#13 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:142:29)
<asynchronous suspension>
#14 _rootRun (dart:async/zone.dart:1124:13)
#15 _CustomZone.run (dart:async/zone.dart:1021:19)
#16 _runZoned (dart:async/zone.dart:1516:10)
#17 runZoned (dart:async/zone.dart:1463:12)
#18 AppContext.run (package:flutter_tools/src/base/context.dart:141:18)
<asynchronous suspension>
#19 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:361:19)
<asynchronous suspension>
#20 CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:111:29)
#21 new Future.sync (dart:async/future.dart:224:31)
#22 CommandRunner.run (package:args/command_runner.dart:111:11)
#23 FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:241:18)
#24 run.<anonymous closure> (package:flutter_tools/runner.dart:60:20)
<asynchronous suspension>
#25 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:142:29)
<asynchronous suspension>
#26 _rootRun (dart:async/zone.dart:1124:13)
#27 _CustomZone.run (dart:async/zone.dart:1021:19)
#28 _runZoned (dart:async/zone.dart:1516:10)
#29 runZoned (dart:async/zone.dart:1463:12)
#30 AppContext.run (package:flutter_tools/src/base/context.dart:141:18)
<asynchronous suspension>
#31 runInContext (package:flutter_tools/src/context_runner.dart:43:24)
<asynchronous suspension>
#32 run (package:flutter_tools/runner.dart:51:10)
#33 main (package:flutter_tools/executable.dart:51:9)
<asynchronous suspension>
#34 main (file:///E:/b/build/slave/Windows_Flutter_Packaging/build/archive/flutter/packages/flutter_tools/bin/flutter_tools.dart:8:3)
#35 _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:287:32)
#36 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
编辑2:感谢Siavash所说的“颤抖清洁”。 解决了问题!
仍然对这个问题的“原因”感到好奇。
答案 0 :(得分:0)
感谢Siavash:从项目文件夹内部轻松清理问题(或直接使用VSCode终端)。
答案 1 :(得分:0)
这里有一个答案。请参阅以下步骤:- 1- 转到您保存的 flutter 文件夹,运行“flutter_console.bat”文件。将打开一个控制台。 2- 输入“颤振医生”。:- 3- 它将显示您的颤振设置中的所有问题。就我而言,您可以看到:-
C:\Users\M A Hafeez>颤动医生
医生摘要(要查看所有详细信息,请运行 flutter doctor -v):
[√] Flutter(Channel stable, 1.22.5, on Microsoft Windows [Version 10.0.19042.685], locale en-US)
flutter_run
[!] Android 工具链 - 为 Android 设备开发(Android SDK 版本 30.0.3) X 未找到 Java 开发工具包 (JDK);您必须在 PATH 中设置环境变量 JAVA_HOME 和 java 二进制文件。您可以从 https://www.oracle.com/technetwork/java/javase/downloads/ 下载 JDK。
[!] Android Studio(未安装)
[√] VS Code(1.52.1 版)
[√] 已连接设备(1 个可用)
!医生发现了 2 类问题。
基本上我的错误是关于 Java,在遇到这个错误之前我没有安装。
希望这会有所帮助。 :)
享受编码