Running on:
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:
minSdk
parameter in /android/app/build.gradle
to 21, but nothing changed.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
Invalidate Caches...
in Android Studio, by going to Files -> Invalidate Caches... -> Invalidate and Restart, but nothing changed./gradlew clean
and then ./gradlew build
in the android/
folder, 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.
I had the same problem and finally I got the solution.
First Update your Android Studio (For me is 2024.3.1 Patch 1 Version). Then do these steps:
Click on File
and the click Open
Choose android
folder under your project route
Click OK
and wait for Andriod Studio to sync
Click on Sync Project with Gradle Files
(Ctrl + Shift + O)
Now, you can right click on app -> New -> Widget -> App Widget
Thats it.
Hope it help you. Good Luck.