I faced the same issue after upgrading to Flutter 3.29.0+, and it's not directly related to your code or dependencies, but rather due to the changes introduced in the Flutter Android Gradle plugin.
Starting with Flutter 3.19.0+, the previous way of applying the Android Gradle plugin has been deprecated, which affects how your Android build files are structured and processed. If you haven’t already updated your Gradle setup, this will likely cause build or runtime failures.
To resolve this, you’ll need to migrate your project’s Gradle configuration properly. The necessary changes involve updating the following files:
android/build.gradle
android/settings.gradle
android/app/build.gradle
The Flutter team has provided an official migration guide that walks through exactly how to restructure your Gradle setup to be compatible with the latest versions:
Flutter Gradle Plugin Migration Guide
Make sure to follow this guide carefully to avoid future compatibility issues. Once the migration is complete, your build and run problems should be resolved.