Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. 解决办法

今天编译一个之前在家里打包的项目 然后发现公司的电脑编译不过 问题如下

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings

 发现是Gradle版本的问题 导致出现的这个问题

根据上面的提示在Terminal里面输入如下指令 

gradlew --warning-mode all

编译后有如下提示

> Configure project :
The RepositoryHandler.jcenter() method has been deprecated. This is scheduled to be removed in Gradle 8.0. JFrog announced JCenter's sunset in February 2021. Use mavenCentral() instead. Consult the upgrading guide for further inform
ation: https://docs.gradle.org/7.2/userguide/upgrading_version_6.html#jcenter_deprecation
        at build_al187h50hbdustpaoood7j9ji$_run_closure1$_closure3$_closure5.doCall(G:\AndroidStudioProject\noaar\mjTest\mj\build.gradle:8)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)

说的很明白 jcenter()这个函数已经被弃用替换为mavenCentral()函数即可

找到build.gradle文件 原本是

allprojects {
    buildscript {
        repositories {
            jcenter()
            google()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:7.0.4'
        }
    }

    repositories {
        jcenter()
        google()
    }
...
}

修改为如下就行了

allprojects {
    buildscript {
        repositories {
            mavenCentral()
            google()
        }

        dependencies {
            classpath 'com.android.tools.build:gradle:7.0.4'
        }
    }

    repositories {
        mavenCentral()
        google()
    }
...
}

再次编译发现过了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小张不爱写代码

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值