Due to Googles request to change the minsdk target I updated my project. It also required me to update gradle. After several attempts it was giving me errors so instead I migrated the project to a clean Flutter installation, everything new.
I’m using gradle wrapper distributionUrl=https://services.gradle.org/distributions/gradle-7.6.3-all.zip
In settings.gradle I’m using:
id "org.jetbrains.kotlin.android" version "1.9.23" apply false
After I run flutter clean I run flutter build appbundle, and I always get the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> java.lang.NullPointerException (no error message)
…so then I run
flutter pub outdated
…which tells me everything is all up-to-date. THEN I run flutter build appbundle again and it works!!
And sometimes, after Flutter clean I am told to run flutter pub outdated, but I immediately get the error:
ERROR_ACCESS_DENIED file system exception thrown while trying to create a symlink from source to dest
..Then I run the same thing again and it runs.
but as my dependencies are all up to date, why do I have to run flutter pub outdated to get rid of the error? And how are the two linked?
Ensure Compatibility: Verify that all your dependencies and plugins are compatible with Gradle 7.6.3 and the Kotlin version you’re using.
Clean and Rebuild: Sometimes, residual files can cause issues. Run:
./gradlew clean
./gradlew build --stacktrace --debug
This will provide more detailed logs to help identify the root cause.
Running flutter pub outdated helps identify outdated dependencies, but it shouldn’t be necessary to run it every time to fix build issues. The fact that running it resolves your build issues suggests there might be underlying dependency conflicts or cache issues.
Dependency Conflicts: Ensure there are no conflicts between your dependencies. Sometimes, transitive dependencies can cause issues.
Cache Issues: Clear the Flutter and Gradle caches to ensure there are no corrupted files:
flutter clean
./gradlew clean
flutter pub cache repair
I hope this may help you
1