【问题标题】:Flutter could not download kotlin-compiler-embeddedable-1.5.21.jar (org.jetbrains.kotlin:kotlin-compiler-embeddable-1.5.21.jarFlutter 无法下载 kotlin-compiler-embeddedable-1.5.21.jar (org.jetbrains.kotlin:kotlin-compiler-embeddable-1.5.21.jar
【发布时间】:2022-01-08 17:39:42
【问题描述】:

我正在创建一个 Flutter 应用程序。

现在我想将 Flutter OSM 添加到项目中以使用地图。但是在将 flutter_osm_plugin 添加到 pubspec.yaml 之后,我收到了一个错误:

[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':flutter_osm_plugin'.
> Could not resolve all artifacts for configuration ':flutter_osm_plugin:classpath'.
   > Could not download kotlin-compiler-embeddable-1.5.21.jar (org.jetbrains.kotlin:kotlin-compiler-embeddable:1.5.21)
      > Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.5.21/kotlin-compiler-embeddable-1.5.21.jar'.
         > Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.5.21/kotlin-compiler-embeddable-1.5.21.jar'.
            > Connect to fodev.org:8118 [fodev.org/45.129.39.130] failed: Connection refused: connect
> Failed to notify project evaluation listener.
   > Could not find method implementation() for arguments [project ':flutter_plugin_android_lifecycle'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
   > Could not find method implementation() for arguments [project ':location'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* 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 19s
Running Gradle task 'assembleDebug'...                             23,6s
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
Exception: Gradle task assembleDebug failed with exit code 1

kotlin-compiler-embeddable-1.5.21.jar 从浏览器下载。但我无法从 Android Studio 安装它。我没有杀毒软件。

有什么问题?非常感谢。

【问题讨论】:

    标签: android flutter android-studio kotlin


    【解决方案1】:

    听起来您可能正在使用 Android Studio(与 VSCode 或 Flutter CLI)构建您的 Flutter 应用。请尝试此线程中的建议:Could not download kotlin-compiler-embeddable.jar

    • 确保您没有处于离线模式:

      • 通过单击文件 > 设置(在 Mac 上,Android Studio > 首选项)打开首选项窗口。

      • 在左侧窗格中,单击构建、执行、部署 > Gradle。勾选 Offline work 复选框。

      • 单击应用或确定。

    • 更新库版本:

      • 单击依赖项> 查找并单击 org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21(或您当前的任何版本)
      • 在详细信息 > 更新部分下,单击 [更新变量] > [更新依赖项]

    请确认您的构建环境(A/S?);如果您解决了问题,请告诉我们。

    【讨论】:

    • 谢谢。我使用的是 Android Studio 版本 2020.3.1 (Arctic Fox),但没有“离线工作”选项。
    • 我拥有所有三个 A/S、VSCode 和 CLI。我个人大部分时间的偏好是 VSCode。这可能没有任何 JetBrains 依赖项。请尝试上面的“更新库”版本建议。 “更新”您看到的每个 Jetbrains 依赖项,“清理”和“重建”。另外:尝试文件>项目结构>建议并更新所有文件,然后单击应用。 [i.stack.imgur.com/4wwCW.png]
    • 谢谢。但我没有“建议”选项。我会尝试以另一种方式更新。
    • 问:问题解决了吗? Q:你能编译A/S的OUTSIDE吗?例如,您是否可以从命令行创建一个新的 Flutter 项目,复制您的 lib* 源代码和 pubspec.yaml 文件,然后从 CLI(或等效地从 VSCode)编译和运行?问:您能Edit您的帖子并向我们展示您的 pubspec.yaml 吗? PS:我简要查看了我在 Ubuntu 上安装的 A/S Arctic Fox 2020.3.1 Patch 2 ... 它提醒了我为什么不喜欢 A/S ;)
    【解决方案2】:

    非常感谢。我已经解决了这个问题。

    我更改了 kotlin 编译器版本并在 HTTP 设置中选择了“无代理”。

    【讨论】:

    • 感谢您分享您的解决方案。请考虑“接受”它;这会将问题标记为“已关闭”......并帮助其他有类似问题的人更轻松地找到您的解决方案。
    猜你喜欢
    • 2021-12-24
    • 1970-01-01
    • 1970-01-01
    • 2021-01-05
    • 1970-01-01
    • 1970-01-01
    • 2021-04-02
    • 2021-09-27
    • 2020-11-21
    相关资源
    最近更新 更多