【问题标题】:have problem in my flutter application , worked fine till yesterday but today i am getting build error我的颤振应用程序有问题,直到昨天都可以正常工作,但今天我遇到了构建错误
【发布时间】:2022-11-05 14:54:19
【问题描述】:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve com.facebook.android:facebook-android-sdk:latest.release.
     Required by:
         project :app
      > Failed to list versions for com.facebook.android:facebook-android-sdk.
         > Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml.
            > Could not HEAD 'https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml'.
               > Read timed out

* 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 2m 8s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

这是我在运行应用程序时遇到的错误

我尝试在我的 build.gradle 文件中添加 mavenCentral() 作为其中的一些建议,但它对我不起作用。我也试过

 implementation 'com.facebook.android:facebook-android-sdk:latest.release'

但还是一样

【问题讨论】:

    标签: flutter build.gradle facebook-login


    【解决方案1】:

    我现在遇到了同样的问题,我发现 jcenter 出现了中断:

    https://status.gradle.com/

    【讨论】:

    • 那么解决方案是什么?
    • 我遵循了这个解决方案stackoverflow.com/a/74261013/7914759 我已经从我的 build.gradle 中删除了 jcenter 并首先在没有互联网连接的情况下构建了应用程序,而不是用它进行了重建。它对我有用。
    • 这不适用于 CI/CD。
    【解决方案2】:

    嗨,在您的 build.gradle 中,您不应该添加实现 “com.facebook.android:facebook-login:15.0.2”因为这个插件 已经为您定义了该依赖项。

    参考:https://github.com/darwin-morocho/flutter-facebook-auth/issues/301#issuecomment-1296944186

    从 build.gradle 中删除这一行: implementation 'com.facebook.android:facebook-android-sdk:latest.release'

    【讨论】:

      【解决方案3】:

      作为临时措施,

      我建议使用这个

      allprojects {
          repositories {
              // Jcenter mirror
              maven { url "https://maven.aliyun.com/repository/jcenter" }
              // other repo
          }
      }
      

      或其他镜子

      - - 更新 - -

      以其他方式

      allprojects {
          repositories {
              all { ArtifactRepository repo ->
                  if (repo instanceof MavenArtifactRepository) {
                      if (repo.url.toString().startsWith('https://jcenter.bintray.com/')) {
                          remove repo
                          add(mavenCentral())
                      }
                  }
              }
          }
      }
      

      如果 jcenter url 存在,此代码将更改为 mavenCentral url。

      【讨论】:

      • 没有用..还有其他解决方法吗?
      • 您是否删除了 Jcenter() 行?
      • 我确实尝试过一次使用 Jcenter() 并在下次删除它的两种情况下.. 两者都没有成功
      • 它不起作用。
      • 更新帖子。请检查一下
      【解决方案4】:

      从几个小时的研究如果最终发现。这是一个问题,因为 jcenter 已关闭。 根据official documentation jcenter 被贬低和Bintray/JCenter users should start migrating to a new hosting solution. 解决方案是从build file 中删除 jcenter 并将其替换为

      mavenCentral() // <- add it
      

      对于 react-native 用户 jcenter() 可能存在于您最近安装的某些依赖项中。检查 jcenter 在android-studio 中打开您的项目以轻松检查所有build.gradle 文件。

      另一个解决方案是断开您的系统与互联网的连接并构建您的项目。在您启动项目后,将您的系统重新连接到互联网。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-04-12
        • 1970-01-01
        • 2021-05-14
        • 2019-08-08
        • 1970-01-01
        • 2023-03-30
        • 2021-06-14
        • 2023-03-23
        相关资源
        最近更新 更多