“Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0”问题解决

1. 问题描述:

今天,编译一个app,在其他同事电脑上可以编译过,在自己电脑上编译不过,出现如下问题:

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0, 具体如下:

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warningsv

显然,是gradle版本的限制,导致出现的问题。

2. 问题排查与分析:

根据提示,用如下命令

gradlew --warning-mode all

进行编译,提示如下:

> Configure project :
The compile configuration has been deprecated for dependency declaration. This will fail with an error in Gradle 6.0. Please use the implementation configuration instead. 
......

很显然,在Gradle 6.0,不支持compile了,所以,在build.gradle文件中,将compile改为implementation,问题就解决了。

3. 问题解决:

build.gradle文件中,将compile改为implementation,问题就解决了,如下:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    ....
    //compile project(':my-sdk-debug')               //旧的写法
    implementation(name:"my-sdk-debug",ext:"aar")  //新的写法
}

————————————————

转载于:https://blog.csdn.net/liranke/article/details/117262807

猜你喜欢

转载自blog.csdn.net/weixin_42602900/article/details/125971273