Flutter: Failed to notify project evalution listener

又是一个常见的flutter的环境问题,一般发生在引用了plugin之后。因为默认的gradle,kotlin之类的比较旧,而所引用的plugin里面的gradle,kotlin比较新。所以会有这个问题,如图:

Flutter: Failed to notify project evalution listener
解决方式也是很简单,一顿升级gradle,gradle wrapper和kotlin。
仅以android studio为例:
首先,右键你的flutter项目,选择Flutter->Open Android Module in Android Studio。
Flutter: Failed to notify project evalution listener
如上图,有几个build.gradle文件,依次打开找到如下代码(如果有的话):

buildscript {
    ext.kotlin_version = '1.2.30'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

ext.kotlin_version = '1.2.30'换成 ext.kotlin_version = '1.2.71',把 classpath 'com.android.tools.build:gradle:3.1.0'换成 classpath 'com.android.tools.build:gradle:3.2.1'
再打开gradle-wrapper.properties,如下:

#Wed Oct 10 15:20:17 CST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip换成distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
至此问题解决。
有的朋友打包里还可能会遇到下面的问题:

Unable to resolve dependency for ':app@dynamicProfile/compileClasspath': Could not resolve project :fluwx.
Open File
Show Details


Unable to resolve dependency for ':app@dynamicProfile/compileClasspath': Could not resolve project :sona.
Open File
Show Details


Unable to resolve dependency for ':app@dynamicProfileUnitTest/compileClasspath': Could not resolve project :fluwx.
Open File
Show Details

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip换成distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip就解决了。

上一篇:JAVA抽象类,接口,多态,抽象方法,一次列举


下一篇:Flutter: Semantics控件