Solve AndroidStudio errors: #001 GradleException in app/build.gradle flutter project

Welcome to short snippets to various problems that you encounter as you are coding. Let me get straight into it.

  1. Gradle error when editing a flutter app in the build.gradle file located in the android/app/build.gradle

This is the error:

def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") }

Solution: Replace the GradleException with FileNotFoundException see code snippet below:

def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new FileNotFoundException ("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") }

Update your compile SDK Version

android { compileSdkVersion to 29 (and 29++)

and

applicationId "name of AppID" minSdkVersion any targetSdkVersion 29 (and 29++) versionCode flutterVersionCode.toInteger() versionName flutterVersionName }

that is it folks!

Like and share!