【问题标题】:Can't run my Flutter project (also new project)无法运行我的 Flutter 项目(也是新项目)
【发布时间】:2022-01-19 20:40:02
【问题描述】:

前不久,一夜之间遇到了flutter的问题,所以决定卸载flutter、dart和gradle。尽管重新安装了所有东西,但使用 --version 检查环境变量是否正确,我仍然有错误但有所不同。根据我正在尝试做的事情,我会在下面列出不同的错误。

运行 main.dart 时出错:

FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':flutter_email_sender:compileDebugKotlin'.
Compilation error. See log for more details

当我在项目的 android 目录中尝试 ./gradlew clean 时出错:

FAILURE: Build failed with an exception.
* What went wrong:
Unable to get mutable Windows environment variable map

我尝试 gradle build 时出错:

> Configure project :app
WARNING: The option setting 'android.enableR8=true' is experimental and unsupported.
The current default is 'false'
Consider disabling R8 by removing 'android.enableR8=true' from your 
gradle.properties before publishing your app.

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\cleme\OneDrive\Bureau\Ptut\xflop\android\app\build.gradle'                     line: 25

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not initialize class   org.jetbrains.kotlin.gradle.plugin.sources.DefaultKotlinSourceSetKt

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

我的工具版本:

  • 颤振 2.8.0
  • 飞镖 2.15.0
  • Gradle 7.3.1(我也尝试过使用 gradle 6.7.1,结果相同)

【问题讨论】:

    标签: android flutter gradle


    【解决方案1】:

    请像下面这样更新你的 kotlin 版本

    buildscript {
    ext.kotlin_version = "1.3.72"//update with latest version
    repositories {
        google()
        jcenter()
    
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    
    }
    

    }

    【讨论】:

    • 您好,我的 kotlin 版本是 1.3.50,我更新到 1.3.72 但还是有错误
    猜你喜欢
    • 2019-01-24
    • 2018-04-05
    • 2022-12-02
    • 2017-02-01
    • 2021-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多