【问题标题】:flutter build error: Execution failed for task ':firebase_core:compileDebugJavaWithJavac'颤振构建错误:任务':firebase_core:compileDebugJavaWithJavac'的执行失败
【发布时间】:2021-09-03 12:48:09
【问题描述】:

我目前正在使用 Flutter 2.2.2 版和最新的 android studio。 我有一个 Flutter 项目几个月前运行良好,但现在 - 在升级 Flutter 和 dart 之后 - 它无法运行。

我尝试降级 Flutter 和 dart,但运行时不断收到相同的错误:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':firebase_core:compileDebugJavaWithJavac'.
> java.time.DateTimeException: Invalid value for MonthOfYear (valid values 1 - 12): 0

* 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

BUILD FAILED in 18s
Exception: Gradle task assembleDebug failed with exit code 1

我有这个 pubspec.yaml 依赖项:

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  http: ^0.12.2
  email_validator: '^1.0.5'
  path_provider: ^1.6.18
  social_share: ^2.0.5
  firebase_admob: ^0.10.2

我尝试将firebase_admob 更改为google_mobile_ads,但这也没有解决问题。

我已经在使用 AndroidX。

任何人都能看出问题吗?有人有可能的解决方案吗? 谢谢!

【问题讨论】:

    标签: android flutter android-studio dart


    【解决方案1】:

    问题出在 JAVA DEVELOPMENT KIT 版本上。 我将其更改为 11.0.11 版本,它工作得很好。 为此,请下载正确的 JDK 并更改 JAVA_HOME 环境变量。

    重要提示:Java 版本太新可能无法正常工作。版本 11 应该没问题(和互联网上其他人所说的版本 8)。

    【讨论】:

      猜你喜欢
      • 2020-05-30
      • 2021-08-30
      • 1970-01-01
      • 2022-09-23
      • 2020-03-29
      • 2020-10-24
      • 1970-01-01
      • 2020-04-04
      • 2022-07-21
      相关资源
      最近更新 更多