I am using Android Studio as SDK Platforms and SDK Tools. Currently, I am facing a problem when running the android emulator using Visual Studio. I have checked flutter doctor and no issues has been found. However, it shows an error as below.
As i run flutter run --verbose to search for the problems, it shows more details of the error as below
CodePudding user response:
To solve your error you have to update your compileSDKversion
to the newest version which is currently 31.
You can find the compileSDKversion
inside android > app > build.gradle
android {
compileSdkVersion 31
...
}
Note: you have to close and open android studio again
Hope it helps!
CodePudding user response:
This look like gradle compatibility issue.
Step to solve.
- create new flutter project. try to compile the prject, if it work fine. compare the android folder with yours and replace what is missing with the new flutter project you created.
- sync your project after.
- file/invalidateCache
- flutter clean
- flutter pub get
- flutter run
you should be fine