当我try 构建/运行该应用程序时,我收到以下错误:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform flexbox-2.0.1.aar (com.google.android:flexbox:2.0.1) to match attributes {artifactType=android-aar-metadata, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Could not find flexbox-2.0.1.aar (com.google.android:flexbox:2.0.1).
        Searched in the following locations:
            https://jcenter.bintray.com/com/google/android/flexbox/2.0.1/flexbox-2.0.1.aar

* 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 13s
Exception: Gradle task assembleDebug failed with exit code 1

有没有办法解决这个问题?

推荐答案

该问题的原因是依赖项flexbox-2.0.1托管在已关闭的jcenter()上.

解决此问题的一种解决方案是从build.gradle (Project Level)文件中的所有存储库对象中删除jcenter()存储库,并为其添加镜像存储库,例如Aliyun Mirror:

buildscript {
    ext.kotlin_version = '1.8.22'
    repositories {
        google()
        mavenCentral()
-       jcenter()
+       maven { url "https://maven.aliyun.com/repository/jcenter" }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
-       jcenter()
+       maven { url "https://maven.aliyun.com/repository/jcenter" }
    }
}

Android相关问答推荐

我遇到了一个HashMaps对象没有存储在Firebase数据库中的问题.HashMap的一个对象put方法未被存储

长流与长流的比较<>

Jetpack Compose中的导航找不到NavHost类的名称为:startDestination";的参数

如何在Reaction Native中显示Google Map iFrame?

如何禁用Android 34+版的TileService,但保留以前的版本?

Jetpack创作动画断断续续变化的观点

如何在停止和销毁时更改函数中Firebase实时数据库的子项的值我试过了,但这不起作用.请使用Kotlin

如何更新Kotlin中的显示?

如何从URI中获取图像大小

OutlinedTextField仅显示一次

当提供非状态对象时,compose 如何进行重组

如何使用其他组件的位置来定位自定义弹出窗口

如果 auth 失败,如何显示 toast jetpack compose firebase if else @Composable 调用只能在 @Composable 函数的上下文中发生

AttributionSource 需要 android.permission.BLUETOOTH_SCAN 权限的问题

在事件中使用 Context/Toast 时不需要的重组 - Jetpack Compose

Android:appcompat 和 material 如何从默认创建 appcompat 和 material 视图?

如何对齐文本和图标可组合,以便即使在文本溢出后它们也能保持在一起?

如何将房间数据库导出到 .CSV

不能在kotlin的lazycolumn中使用列表

在delphi中将Jnet_uri转换为Tbitmap