gpt4 book ai didi

android - 警告 : [options] source value 7 is obsolete and will be removed in a future release

转载 作者:行者123 更新时间:2023-12-04 11:18:54 24 4
gpt4 key购买 nike

运行flutter run时出现ff错误。

warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
error: warnings found and -Werror specified

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':connectivity:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* 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
这是我的 flutter 医生输出:
[√] Flutter (Channel stable, 1.20.4, on Microsoft Windows [Version 10.0.18362.1139], locale en-US)
• Flutter version 1.20.4 at C:\src\flutter
• Framework revision fba99f6cf9 (8 weeks ago), 2020-09-14 15:32:52 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2


[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\USER01\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: C:\PROGRA~1\Java\jdk-13.0.2\bin\java
• Java version Java(TM) SE Runtime Environment (build 13.0.2+8)
• All Android licenses accepted.
我似乎无法在谷歌上找到任何东西。我该如何解决这个错误?

最佳答案

这是针对即将被弃用的旧版本 Java(在本例中为 7)的编译器的警告。
要解决此问题,您有两种选择:

  • 您可以设置您的JAVA_HOME到旧版本的 Java,然后运行你的 Flutter 构建。您还需要拥有这个 JAVA_HOME在您构建的任何地方都可用(命令行、IDE、CI/CD 等)
  • 或者我更喜欢的方式是告诉 Gradle 使用较旧的 Java 工具链来编译 Java 源代码。

  • 要执行选项 2,请更新您的 allprojects android/build.gradle的部分如下所示:

    allprojects {
    repositories {
    google()
    mavenCentral()
    }

    tasks.withType(JavaCompile).configureEach {
    javaCompiler = javaToolchains.compilerFor {
    languageVersion = JavaLanguageVersion.of(8)
    }
    }
    }
    这包括更新已弃用的 jcenter Maven 存储库。
    编辑 2021 年 11 月:对工具链的支持也已添加到 Kotlin Gradle 插件中。
    https://blog.jetbrains.com/kotlin/2021/11/gradle-jvm-toolchain-support-in-the-kotlin-plugin/

    关于android - 警告 : [options] source value 7 is obsolete and will be removed in a future release,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64791058/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com