I was working on a project that have the Android Version 31 SDK then for testing purpose, I installed a package from pub.dev in pubspec.yaml that require Android Version 33 SDK that I don't want to upgrade so I change the back version again in pubspec.yaml and deleted pubspec.lock then run flutter pub get but from here it started showing me error as "... Some of the Plugins needs Android Version 33 SDK ..."
Now my project is totally stuck and can Run & Build due to this error. For the resetting purpose, I did the following...
- Deleted
pubspec.lockthen runflutter pub get. - Run
flutter pub cache repairthen runflutter pub get - Run
flutter pub cache cleanthen runflutter pub get - Run "Invalidates Caches..." in Android Studio then run
flutter pub get - In Android Studio go to Tools -> SDK Manager -> Appearance & Behaviour -> System Settings -> Android SDK -> Uninstall Android API 33 then run
flutter pub get - In Android Studio go to Tools -> SDK Manager -> Appearance & Behaviour -> System Settings -> Android SDK -> Uninstall Android Build Tool API 33 then run
flutter pub get - Deleted build and .dart Folders then run
flutter pub get - Run
flutter cleanthen runflutter pub get
What To Do Now To Revert My Project At Android Version 31 SDK...???
Note:
Doing everything as shared earlier, I open my pubspec.lock and seeing every-time new version of my installed package that require Android Version 33 SDK even pubspec.yaml is showing my old version of installed package means they both are not same in versions.
Flutter Doctor:
[✓] Flutter (Channel stable, 2.10.5, on macOS 12.4 21F79 darwin-arm, locale en-GB)
• Flutter version 2.10.5 at /Users/novusaltairkarachi/Documents/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5464c5bac7 (5 months ago), 2022-04-18 09:55:37 -0700
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/novusaltairkarachi/Library/Android/sdk
• Platform android-33, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 105.0.5195.125
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Process finished with exit code 0
More Info As Requested, Rest Information Is Shared In Upper "flutter doctor" Result:
compileSdkVersion 31
minSdkVersion 21
targetSdkVersion 31