天使漫步IT工作室天使漫步IT工作室

Configuration 'compile' is obsolete and has been replaced with 'implementation'. It will be removed at the end of 2018

一、问题描述:

android stadio 升级到3.1以后会更新各种依赖插件,最后发现在gradle编译以后,出现如下警告:

Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018


Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018


Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018


Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018


Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018


Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018


Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018


Configuration 'debugCompile' is obsolete and has been replaced with 'debugImplementation'.
It will be removed at the end of 2018


Configuration 'releaseCompile' is obsolete and has been replaced with 'releaseImplementation'.
It will be removed at the end of 2018


Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018


Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018


Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018


Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018


Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018


Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018


Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018


Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018


Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018


Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018


Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018


Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018


Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018


Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018


Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018


Configuration 'androidTestApi' is obsolete and has been replaced with 'androidTestImplementation'.
It will be removed at the end of 2018


Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018


Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018


Configuration 'androidTestCompile' is obsolete and has been replaced with 'androidTestImplementation'.
It will be removed at the end of 2018

二、解决办法

compile会被在2018年底取消,被api替代成implementation,所以会报这个警告,解决警告的方式就是换成api就好了。

即:gradle中的compile 换成 implementation 即可。

以此类推:

  • androidTestApi 替换为 androidTestImplementation
  • androidTestCompile 替换为 androidTestImplementation
  • testApi 替换为 testImplementation
  • testCompile 替换为 testImplementation
  • debugCompile 替换为 debugImplementation
  • releaseCompile 替换为 releaseImplementation

所有的api替换为右边的新api,再编辑警告即可解除。

三、解释

关于compile与implementation的区别:

  • compile:可以传递依赖引用,编译时间相对来说长久一些。
  • implementation:不可传递依赖引用,比如,B依赖A,C再依赖B,C却不能依赖A的引用或者依赖。当然他的编译时间就会短一些。

即功能相同,只是在编译上作了一些优化。

本站原创,欢迎转载,转载敬请标明出处:天使漫步IT工作室 » Configuration 'compile' is obsolete and has been replaced with 'implementation'. It will be removed at the end of 2018
添加新评论