'"the device is not ready" when running Flutter app

I install latest version of flutter on windows 10 and when I want to run app with VScode or Android Studio, I get this error:

FAILURE: Build failed with an exception.

* What went wrong:
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
Exception: Gradle task assembleDebug failed with exit code 1

I already try flutter pub cache repair and flutter clean but that did not work.



Solution 1:[1]

run these commands:

flutter clean
flutter pub get

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Reza Abdollahi