Did you tried running flutter doctor --android-licenses
and accept all of them? that sometimes could cause issues if you didn't done that, also I found some other solutions to a similiar issue here: flutter error Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'
Also I'm not sure if you're on windows using WSL but looks like its one of the situations that could also cause your issue https://youtrack.jetbrains.com/issue/IDEA-291122/Cannot-query-the-value-of-this-provider-because-it-has-no-value-available-when-importing-the-Android-project