본문 바로가기
프로그래밍/Flutter

Flutter tip : gradle build failed after flutter upgrade or pub upgrade

by drogrammer 2023. 4. 23.
반응형

1. Error message

org.gradle.api.GradleScriptException: A problem occurred evaluating project ':app'

 

2. Solution

Mostly this is caused by gradle version mismatch. Don't  wast your time trying to solve problems by analyzing the code. It's better for your mental helth to compare it with a new project and solve it.

Step 1. Create a new project

flutter create test

Step 2. Modify "distributionUrl" in android/gradle/wrapper/gradle-wrapper.properties as written in a new project

Example)

distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

Step 3. Modify "ext.kotlin_version" in android/build.gradle as written in a new project

Example)

buildscript {
    ext.kotlin_version = '1.7.10'

Step 4. Modify "classpath" of "com.android.tools.build:gradle" in android/build.gradle as written in a new project

Example)

    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.0'
반응형

댓글