当前位置:   article > 正文

Flutter: Failed to notify project evalution listener

failed to notify project evaluation listener. > org/jetbrains/kotlin/gradle/

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

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

  1. buildscript {
  2. ext.kotlin_version = '1.2.30'
  3. repositories {
  4. google()
  5. jcenter()
  6. }
  7. dependencies {
  8. classpath 'com.android.tools.build:gradle:3.1.0'
  9. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  10. }
  11. }

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,如下:

  1. #Wed Oct 10 15:20:17 CST 2018
  2. distributionBase=GRADLE_USER_HOME
  3. distributionPath=wrapper/dists
  4. zipStoreBase=GRADLE_USER_HOME
  5. zipStorePath=wrapper/dists
  6. 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
至此问题解决。
有的朋友打包里还可能会遇到下面的问题:

  1. Unable to resolve dependency for ':app@dynamicProfile/compileClasspath': Could not resolve project :fluwx.
  2. Open File
  3. Show Details
  4. Unable to resolve dependency for ':app@dynamicProfile/compileClasspath': Could not resolve project :sona.
  5. Open File
  6. Show Details
  7. Unable to resolve dependency for ':app@dynamicProfileUnitTest/compileClasspath': Could not resolve project :fluwx.
  8. Open File
  9. 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就解决了。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/223467
推荐阅读
相关标签
  

闽ICP备14008679号