Hello Guys How are you all? Hope You all are fine. When I was trying to run my flutter app and suddenly I get the following error in my stack track. Gradle failure A problem occurred evaluating project ‘:app’ in a flutter. So today Here I come with all possible solutions for this error.
We are providing you all possible solutions to solve this error. let’s start this article without wasting your time.
How Gradle failure A problem occurred evaluating project ‘:app’ Error Occurs ?
Today I am trying to build flutter android app But suddenly I got Build failed with an exception. There is Gradle failing to make build. I got following error in my stacktrack.
FAILURE: Build failed with an exception.
* Where:
Build file 'E:\Flutter_Projects\Tap_and_pin\app\android\app\build.gradle' line: 24
* What went wrong:
A problem occurred evaluating project ':app'.
> ASCII
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
How to Solve Gradle failure A problem occurred evaluating project ‘:app’ Error?
- How to Solve Gradle failure A problem occurred evaluating project ':app' Error?
To Solve Gradle failure A problem occurred evaluating project ':app' Error. Just changing the google services classpath from 4.3.0 to 4.2.0 made that fixed. if solution 1 not worked then just I changed the value of kotlin_version on the same “build.gradle” file. I changed my project/build.gradle file like the following.
- Gradle failure A problem occurred evaluating project ':app'
To Solve Gradle failure A problem occurred evaluating project ':app' Error. Just changing the google services classpath from 4.3.0 to 4.2.0 made that fixed. if solution 1 not worked then just I changed the value of kotlin_version on the same “build.gradle” file. I changed my project/build.gradle file like the following.
Solution 1 : changing google services classpath
Just changing google services classpath from 4.3.0 to 4.2.0 made that fixed.
classpath 'com.google.gms:google-services:4.3.0'
change this into
classpath 'com.google.gms:google-services:4.2.0'
Solution 2 : Change kotlin_version
Here is my project/build.gradle file like following:
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
// ...
}
Also I changed the value of kotlin_version on the same “build.gradle” file.
I changed my project/build.gradle file like following:
// ...
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
// ...
}
In here, my project uses kotlin-gradle-plugin which has a dependency on "$kotlin_version"
. And Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher. So, I changed the value of kotlin_version on the same “build.gradle” file.
Just change
ext.kotlin_version = '1.2.71'
to
ext.kotlin_version = '1.3.0'
And, also you need to go to “android/gradle/wrapper/gradle-wrapper.properties” file and change it to this:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
Now, run “flutter clean” and then “flutter run” command. It works perfectly !
Solution 3 : Rebuild Project
If no any solution worked then just create new project and transfer all assets and lib folder in new project.
I solved it like this:
- Create a new flutter project.
- Copy all the source files and folders.
- Copy pubspec.yaml file over and run Pub git
- Close the project
- Open the project again
- Run project.
Summery
So, It’s All About Gradle failure A problem occurred evaluating project ‘:app’ Error. I hope this tutorial helps you to Solve your error. Please Comment Below if You stucks anywhere with my code. And please comment below on which solution worked for you. Thank You.
Also Check Out Below Tutorials
- No named parameter with the name ‘nullOk’ error in flutter
- Gradle failure may have been because of AndroidX incompatibilities in this Flutter app
- Flutter: CocoaPods’s specs repository is too out-of-date to satisfy dependencies
- The argument type ‘Future’ can’t be assigned to the parameter type ‘void Function()’
- Flutter SDK is not found in the specified location in Android Studio