android gradle编译时报错Could not find method compile() for arguments解决

当升级Gradle到7.4版本时,遇到一个问题:compile方法已过时。解决方法是将build.gradle文件中的compile替换为implementation。更新后的dependencies部分应包括fileTree,以及特定库如android-gif-drawable和crashreport的implementation。
摘要由CSDN通过智能技术生成

现象

升级gradle版本到7.4时出现类似下面的报错

* What went wrong:
A problem occurred evaluating root project 'test-common-lib'.
> Cfind method compile() for arguments [directory 'libs'] on object of type org.gradle.api.int

解决

build.gradle文件下面的complie方法过时了需要改成implementation方法

修改前:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.16'
    implementation 'com.tencent.bugly:crashreport:3.2.1'
}

修改后

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.16'
    implementation 'com.tencent.bugly:crashreport:3.2.1'
}

参考

https://blog.csdn.net/jimmyleeee/article/details/124375033

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值