'Android Studio - I imported a file from GitHub but when I run it it gives an error

I'm working on a Flutter app that I imported from GitHub But when I run it it does not work and gives this error and when I create a new app it doesn't show any problems



Solution 1:[1]

Just create a new flutter project in studio and then replace your lib folder and dependencies in pubspec.yaml if there are some. This could defend you from unexpected errors while working with old projects.

Solution 2:[2]

Open your Project's android folder in Android Studio and from Menu go to Android Studio > Preferences > Build,Execution,Deployment > Build Tools > Gradle. Now here change Gradle JDK version from 1.8 to 11 (given in dropdown).

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 rozerro
Solution 2