'Flutter run is working from terminal, but error from VSCode (F5)

Flutter run is working from terminal, but error from VSCode (F5), error message :

What went wrong: A problem occurred evaluating project ':app'. Could not get unknown property 'compileSdkVersion' for extension 'flutter' of type >FlutterExtension.

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.

Any suggestions how to validate my application? What can case such a problem?

Thank you



Solution 1:[1]

Run this command on your console "flutter clean" "flutter pub get" "flutter run"

Solution 2:[2]

Because I don't completely know what project or process you are working on, I simply checked the error.

The commands flutter clean, flutter upgrade may help. Seems like it is related to JDK17. You can look at this:enter link description herefor more information, there are all kinds of situation.

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 Naimul Emon
Solution 2