Flutter:模拟器无法正常工作 gradle

Flutter : emulator not work get error with gradle

我想 运行 flutter 应用程序与(VSCode 或 Android studio),我都收到此错误:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> java.io.IOException: The device is not ready

* 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 5s
Exception: Gradle task assembleDebug failed with exit code 1

有什么解决办法吗?

我通过 运行 这些命令解决了它:

flutter channel stable
flutter upgrade --force
flutter pub cache repair
flutter clean

得到我的 运行 这个:

flutter clean
flutter pub get

在终端中输入 flutter clean 然后等待。成功执行上一个命令后,键入 flutter pub get 以获取所需的所有依赖项。