【问题标题】:Gradle sync failed: Cause: assert pluginDirectory.exists()Gradle 同步失败:原因:断言 pluginDirectory.exists()
【发布时间】:2021-05-19 05:45:08
【问题描述】:

我在标题及下方出现了错误。当您在文件夹 /android 上打开 Android Studio 时会发生错误。我的项目是一个 Flutter 项目。我在三星 Galaxy A10 上使用 Android 应用 Max 2D Game 创建了我的项目。

Gradle sync failed: Cause: assert pluginDirectory.exists()
                            |               |
                            |               false               > 
                           \root\snap\flutter\common\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.15.1\android 

我邀请您在Gitpod 上探索我的项目或在GitHub 上分叉并提交修复此错误的拉取请求。

在 android/app 文件夹中打开 android studio 我得到以下错误:


FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\Administrator\Downloads\flutter_windows_2.2.0-stable\flutter\packages\flutter_tools\gradle\app_plugin_loader.gradle' line: 27

* What went wrong:
A problem occurred evaluating script.
> assert pluginDirectory.exists()
         |               |
         |               false
         \root\snap\flutter\common\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.15.1\android

* 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 121ms

【问题讨论】:

  • 似乎 pub 缓存不包含该特定插件。尝试再次运行flutter pub get,然后重建应用程序
  • 这为我解决了
  • 哦,太好了,我们应该发布答案以帮助他人。你想让我这样做吗?
  • 是的,你可以做到,我评论的正是在考虑帮助其他人。

标签: flutter android-studio


【解决方案1】:

assert pluginDirectory.exists() 正在返回错误,因为您的 pub cache 不知何故不同步。

在这种情况下,使用命令

flutter pub get

从您的根文件夹中,以便将所有依赖项与缓存重新同步。

【讨论】:

    猜你喜欢
    • 2017-12-06
    • 2018-09-19
    • 1970-01-01
    • 1970-01-01
    • 2016-04-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多