首页 > 编程知识 正文

Android Studio Gradle:请从您的构建脚本中删除" jcenter()"Maven资源库的用法

时间:2023-05-06 15:18:02 阅读:281253 作者:4752

打开 App/Gradle Scripts/build.gradle (Project:---)Change the 'jcenter()' on build script{} and in all project repositories.and Sync now.

更改之前: 

buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:4.2.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }}allprojects { repositories { google() jcenter() }}task clean(type: Delete) { delete rootProject.buildDir}

更改之后:

buildscript { repositories { google() mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:4.2.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }}allprojects { repositories { google() mavencentral() }}task clean(type: Delete) { delete rootProject.buildDir}

 在我的设置如下 只屏蔽  jcenter() 也可以编译运行

// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript { repositories { google() mavenCentral() } dependencies { classpath "com.android.tools.build:gradle:4.2.0" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }}allprojects { repositories { google() mavenCentral() //jcenter() // Warning: this repository is going to shut down soon }}task clean(type: Delete) { delete rootProject.buildDir}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。