I face this issue when I was Building my Flutter Application. This error is due to the gradle version that you are using in your Android Project. Follow the below steps:
Install jdk version 14.0.2 from https://www.oracle.com/java/technologies/javase-jdk14-downloads.html .
If using Windows open C:\Program Files\Java\jdk-14.0.2\bin , Copy the Path and now update the path ( Reffer to this article for updating the path : https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/ .
Open the Project that you are working on [Your Project]\android\gradle\wrapper\gradle-wrapper.properties and now Replace the distributionUrl with the below line:
distributionUrl = https://services.gradle.org/distributions/gradle-6.3-all.zip
Now Save the File (Ctrl + S), Go to the console and run the command
flutter run
It will take some time, but the issue that you were facing will be solved.