Flutter VS Code Emulator 卡在运行 Gradle 任务“assembleDebug”上
从昨天晚上开始,我一直无法在模拟器中打开我的应用程序。到那时为止一切都很好。
Launching lib\main.dart on Android SDK built for x86 in debug mode...
lib\main.dart:1
√ Built build\app\outputs\flutter-apk\app-debug.apk.
通常需要大约 2 分钟才能打开,但它只是卡在那里大约 15 分钟。所以我寻找答案,第一个答案说使用 gradlew clean 和 gradlew build 。我这样做了,但仍然被卡住了,但又出现了另一个错误。
Launching lib\main.dart on Android SDK built for x86 in debug mode...
lib\main.dart:1
Note: C:\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_android-2.0.12\android\src\main\java\io\flutter\plugins\pathprovider\PathProviderPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
√ Built build\app\outputs\flutter-apk\app-debug.apk.
然后我尝试了这里类似问题的答案,建议进行flutter pub缓存修复
。还是没有运气。
然后我尝试了这里答案中的另一个建议来升级颤振。从那以后我已经几个月没有升级flutter了,所以我这样做了,但问题仍然存在。
我从这里的一个问题的评论中读到,当他们在终端中使用 flutter run -v 运行项目时,它在大约 20 分钟后打开。所以我开始了它,因为我的笔记本电脑已经用了 6 年了,运行的是第 6 代 i5 和 8GB 内存,我认为可能需要更长的时间。所以我把它留在那里,现在大约 2 小时后我的终端卡在:
我达到了问题字符限制,所以我将终端的输出输入 在线记事本:https://anotepad.com/notes/3jri4gpc
我刚刚关闭了模拟器,终端将其添加到上面的
[+7331895 ms] executing: C:\Users\hp\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell pm list packages com.example.myapp
[ +90 ms] adb.exe: device offline
[ +27 ms] ProcessException: Process exited abnormally:
adb.exe: device offline
Command: C:\Users\hp\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell pm list packages com.example.myapp
[ +3 ms] Installing APK.
[ +17 ms] Installing build\app\outputs\flutter-apk\app.apk...
[ +8 ms] executing: C:\Users\hp\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 install -t -r
D:\myapp\front\myapp\build\app\outputs\flutter-apk\app.apk
[ +114 ms] Performing Push Install
adb: error: failed to get feature set: device 'emulator-5554' not found
[ +6 ms] Installing build\app\outputs\flutter-apk\app.apk... (completed in 115ms)
[ +5 ms] Error: ADB exited with exit code -1
[ +4 ms] Performing Push Install
adb: error: failed to get feature set: device 'emulator-5554' not found
[ +1 ms] Warning: Failed to install APK.
[ +4 ms] Error launching application on Android SDK built for x86.
[ +9 ms] "flutter run" took 7,368,695ms.
[ +23 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:687:9)
<asynchronous suspension>
#2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1161:27)
<asynchronous suspension>
#3 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#4 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#5 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
<asynchronous suspension>
#6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#8 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#10 main (package:flutter_tools/executable.dart:94:3)
<asynchronous suspension>
[ +172 ms] ensureAnalyticsSent: 163ms
[ +10 ms] Running shutdown hooks
[ +2 ms] Shutdown hooks complete
[ +2 ms] exiting with code 1
From [+7331895 ms] waiting:
在关闭模拟器后的第一行中,我可以看到它运行了大约 122 分钟。
我不明白这里出了什么问题。为什么模拟器突然停止正常工作?
如何让它发挥作用以便我可以继续我的应用程序开发?请帮忙。
Since yesterday evening I've been unable to open my app in emulator. It worked fine till then.
Launching lib\main.dart on Android SDK built for x86 in debug mode...
lib\main.dart:1
√ Built build\app\outputs\flutter-apk\app-debug.apk.
It usually takes about 2 mins to open but it was just stuck there for like 15 mins. So I looked up for answers and the first one said to use gradlew clean
and gradlew build
. I did that and still was stuck but with another error.
Launching lib\main.dart on Android SDK built for x86 in debug mode...
lib\main.dart:1
Note: C:\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_android-2.0.12\android\src\main\java\io\flutter\plugins\pathprovider\PathProviderPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Then I tried an answer from a similar question here that suggested to do flutter pub cache repair
. Still no luck.
Then I tried another suggestion from an answer here to upgrade flutter. I hadn't upgraded flutter for a couple months since so I did that but still the issue persists.
I read from a comment to a question here that when they run the project using flutter run -v
in terminal it opened up after about 20 mins. So I started it and because my laptop is like 6 years old running 6th gen i5 with 8gb ram I thought it might take a bit longer. So I left it there and now after about 2 hours my terminal is stuck at:
I hit the question character limit so I put the terminal's output in
an online notepad at: https://anotepad.com/notes/3jri4gpc
I just closed the emulator and the terminal added this to the above
[+7331895 ms] executing: C:\Users\hp\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell pm list packages com.example.myapp
[ +90 ms] adb.exe: device offline
[ +27 ms] ProcessException: Process exited abnormally:
adb.exe: device offline
Command: C:\Users\hp\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell pm list packages com.example.myapp
[ +3 ms] Installing APK.
[ +17 ms] Installing build\app\outputs\flutter-apk\app.apk...
[ +8 ms] executing: C:\Users\hp\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 install -t -r
D:\myapp\front\myapp\build\app\outputs\flutter-apk\app.apk
[ +114 ms] Performing Push Install
adb: error: failed to get feature set: device 'emulator-5554' not found
[ +6 ms] Installing build\app\outputs\flutter-apk\app.apk... (completed in 115ms)
[ +5 ms] Error: ADB exited with exit code -1
[ +4 ms] Performing Push Install
adb: error: failed to get feature set: device 'emulator-5554' not found
[ +1 ms] Warning: Failed to install APK.
[ +4 ms] Error launching application on Android SDK built for x86.
[ +9 ms] "flutter run" took 7,368,695ms.
[ +23 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:687:9)
<asynchronous suspension>
#2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1161:27)
<asynchronous suspension>
#3 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#4 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#5 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
<asynchronous suspension>
#6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#8 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#10 main (package:flutter_tools/executable.dart:94:3)
<asynchronous suspension>
[ +172 ms] ensureAnalyticsSent: 163ms
[ +10 ms] Running shutdown hooks
[ +2 ms] Shutdown hooks complete
[ +2 ms] exiting with code 1
From [+7331895 ms] executing:
in the first line after closing the emulator I can see that this was running for about 122 minutes.
I don't understand what's wrong here. Why did the emulator stop working normally all of a sudden?
How to make it work so that I can continue with my app development? Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论