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

现象

升级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

猜你喜欢

转载自blog.csdn.net/qq_26545503/article/details/129218417
今日推荐