JCenter deprecation and end of service

在将Gradle升级到7.0.0-alpha10时,遇到JCenter即将退役的提示,需迁移至其他 Maven 仓库。尝试移除jcenter并使用mavenCentral,但编译出现错误,因为缺少kotlinx库。为解决此问题,添加了Kotlin Bintray仓库的引用,但发现Bintray已停止服务。最终采用阿里云Maven仓库作为替代方案,成功解决了依赖问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

gradle 升级到 7.0.0-alpha10 时,工具提示jcenter 要被停止服务了,改用mavenCentral

Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.
This repository is deprecated and it will be shut down in the future.
See http://developer.android.com/r/tools/jcenter-end-of-service for more information.
Currently detected usages in: Gradle Settings
Remove JCenter from repositories

根据提示,找到官方公告链接
JCenter deprecation and end of service

Jfog官方公告

在这里插入图片描述

repositories {
        google()
        mavenCentral()
        jcenter() // Warning: this repository is going to shut down soon
    }

删除jcenter, 编译报错:

Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.3.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlinx/kotlinx-collections-immutable-jvm/0.3.3/kotlinx-collections-immutable-jvm-0.3.3.pom
       - https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/kotlinx-collections-immutable-jvm/0.3.3/kotlinx-collections-immutable-jvm-0.3.3.pom
     Required by:
         project :app > androidx.compose.ui:ui:1.0.0-beta01 > androidx.compose.runtime:runtime:1.0.0-beta01

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

增加maven

  repositories {
        google()
        mavenCentral()
        maven { url 'https://kotlin.bintray.com/kotlinx' }

    }

bintray已停, 可用aliyun maven

allprojects {
  repositories {
    maven {
      url 'https://maven.aliyun.com/repository/public/'
    }
     maven {
      url 'https://maven.aliyun.com/repository/google/'
    }
     maven {
      url 'https://maven.aliyun.com/repository/central/'
    }
    mavenLocal()
    mavenCentral()
  }
}
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值