Juffy 15273830101
Juffy 15273830101

Reputation: 23

MinSdk error when adding an Android App Widget in Flutter Android Studio

Running on:

  1. Flutter 3.24.5
  2. Dart 3.5.4
  3. No issues in flutter doctor

Problem: I am trying to create a Flutter project which should contain a home screen widget. I am stuck on the step of adding a widget in the /android/app/ folder of my project as seen in the image below: Steps to add a widget

My thoughts and attempts: The error suggests my minSdk version is <16. I tried the following fixes, but none worked:

  1. Manually set the minSdk parameter in /android/app/build.gradle to 21, but nothing changed.
  2. Verify the flutter installation files at flutter/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy , but since I am running on Flutter 3.x, the minSdkVersion was already set to 21:
public final int minSdkVersion = 21
  1. Invalidate Caches... in Android Studio, by going to Files -> Invalidate Caches... -> Invalidate and Restart, but nothing changed
  2. Ran ./gradlew clean and then ./gradlew build in the android/ folder, but nothing changed.
  3. Tried everything I could for Flutter 3.x in the already answered StackOverflow thread: Flutter : How to change Android minSdkVersion in Flutter Project?, but nothing changed.

Whatever I try, I always get the "Project not ready" error. I can't find what I am missing. Thank you for your input.

Upvotes: 2

Views: 70

Answers (0)

Related Questions