项目中Gradle版本升级到4.4后,项目构建时,每次出现红色的警告信息:

WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018
Affected Modules: MyCorn-MyCorn
复制代码

但本地项目代码中compile都已经完成了implementation,警告信息依然出现。 一开始百思不得解,警告信息相对过于简单,且对应模块也已经全部完成了替换。

最终考虑使用命令进行项目构建过程,以期望能获取具体的进一步详情信息,因此,输出完整debug日志。

 ./gradlew assembleDevDebug --debug  >  ~/T/gralde.log
复制代码

输出的gralde.log日志信息很大,搜索对应的警告信息。

...
17:17:48.796 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Build operation 'Apply plugin corn-auto-collector to project ':MyCorn'' started
17:17:48.802 [DEBUG] [org.gradle.api.internal.artifacts.mvnsettings.DefaultLocalMavenRepositoryLocator] No local repository in Settings file defined. Using default path: /Users/corn/.m2/repository
17:17:48.805 [WARN] [org.gradle.api.Project] WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018
17:17:48.860 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Completing Build operation 'Apply plugin corn-auto-collector to project ':MyCorn''
...
复制代码

对应的,我们发现是项目中应用了自实现的corn-auto-collector插件,而插件中并未将compile替换成implementation。

修改对应插件的依赖配置,重新构建发现警告信息消失。

Android Studio默认构建时日志是-q级别输出,在必要的时候我们可以修改默认构建日志输出级别。 最常用的有两种方式:
1,修改Android Studio >> Preferences >> Build >> Compiler >> Command-line Options,加入对应日志级别参数,如常用的--debug,--stacktrace;
2,直接使用对应的gradle命令,加上对应的命令参数。

实际项目构建过程中,出现的构建问题,往往日志信息都很简单,并不能一次性定位到问题所在,通过附加参数形式的去获取完整的日志信息,以便详细定位到项目构建过程中的具体问题,非常有效,在实际项目构建过程可以经常使用。

作者:HappyCorn
链接:https://juejin.im/post/5caf35d7e51d456e7079f1f0
来源:掘金
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

解决Configuration 'compile' is obsolete and has been replaced with implementation的更多相关文章

  1. Android Studio3.1.2升级问题:Configuration 'compile' is obsolete and has been replaced with 'implementation'.

    每次升级Android Studio时,一般情况下Gradle版本的也会相应的升级,我之前Android Studio 3.0.1.Gradle 是4.1升级后为:Android Studio 3.1 ...

  2. 安卓 android studio 报错 WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and

    报错截图: 问题原因:compile会被在2018年底取消,会被imlementation替代,所以会报这个警告,解决警告的方式就是换成 imlementation 就好了 解决方法: 在 app 的 ...

  3. WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.

    点击报错信息中的app, 按照提示,修改compile 为 implementation 再次同步即可 结果

  4. Warning:Configuration 'compile' is obsolete and has been replaced with 'implementation'. It will be

    1.替换 compile为implementation. 2.file->invalidate caches 或者build中的clear

  5. API 'variant.getJavaCompiler()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'

    WARNING: API 'variant.getJavaCompiler()' is obsolete and has been replaced with 'variant.getJavaComp ...

  6. react-native Android WARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.

    android Studio 中打开react-native项目的android文件夹 在sync的过程中 发生warning: WARNING: API 'variant.getMergeAsset ...

  7. 如何在Android studio上运行从github上下载的RN项目

    想要编译别人的RN项目,还是要踩踩坑才能走上正轨啊,分享下我试过多种方法后最喜欢的方法(其实是因为我多次用VS Code编译都是以失败而告终,所以才选择的studio) 注意:这一步是你的开发环境都安 ...

  8. Android Studio 升级为3.1 踩到的坑

    原文:https://blog.csdn.net/xiariluoxue/article/details/80050700 AndroidStudio.gradle.buildToolsVersion ...

  9. 【转】AndroidStudio升到最新版本(3.1.2)之后

    AndroidStudio升到最新版本(3.1.2)之后   暂时发现的需要大家注意的地方 1.androidstudio3无法导入moudle? 例如:我写了一个简单的项目,需要导入一个第三方的mo ...

随机推荐

  1. Linux系统中常见文件系统格式

    Windows常用的分区格式有三种,分别是FAT16.FAT32.NTFS格式. 在Linux操作系统里有Ext2.Ext3.Linux swap和VFAT四种格式. FAT16: 作为一种文件名称, ...

  2. springmvc 请求经过controller后静态资源无法访问的问题

    经过RequestMapping(“xx”)后 转发请求时会在url里面附带地址, 导致访问静态资源文件失败, 解决办法是在 spring-mvc.xml文件中加上 <mvc:default-s ...

  3. super()方法的使用

    如果在子类中也定义了构造器,既_init_()函数,那么基类的构造器该如何调用呢? 方法一.明确指定 使用一个子类的实例去调用基类的构造器,在子类的构造器中明确的指明调用基类的构造器. class C ...

  4. 条件随机场CRF(三) 模型学习与维特比算法解码

    条件随机场CRF(一)从随机场到线性链条件随机场 条件随机场CRF(二) 前向后向算法评估标记序列概率 条件随机场CRF(三) 模型学习与维特比算法解码 在CRF系列的前两篇,我们总结了CRF的模型基 ...

  5. Java(五、类和对象中的例题)

    一.方法中的参数为数值型的(int) import java.util.Scanner; public class ScoreCalc { public void calc(int num1,int ...

  6. mac终端命令及pycharm常用快捷键记录

    mac终端命令: 1.root权限 $sudo su - 2.定位到指定文件夹位置 $cd /Users/计算机名称/Desktop     (定位到桌面) 3.新建文件夹 $mkdir 文件夹名称 ...

  7. SpringBoot开发案例从0到1构建分布式秒杀系统

    前言 ​最近,被推送了不少秒杀架构的文章,忙里偷闲自己也总结了一下互联网平台秒杀架构设计,当然也借鉴了不少同学的思路.俗话说,脱离案例讲架构都是耍流氓,最终使用SpringBoot模拟实现了部分秒杀场 ...

  8. Axios源码深度剖析 - 替代$.ajax,成为xhr的新霸主

    前戏 在正式开始axios讲解前,让我们先想想,如何对现有的$.ajax进行简单的封装,就可以直接使用原声Promise了? let axios = function(config){ return ...

  9. android与js的交互之jsbridge使用

    众所周知,app的一些功能可能会使用到H5开发,这就难免会遇到java与js 的相互调用,android 利用WebViewJavascriptBridge 实现js和java的交互,这里介绍下JsB ...

  10. genymotion的安装及运行

    一.下载工具 安装genymontion一共需要下载三个东西,分别是genymotion.虚拟机virtualbox和ova 笔者提供百度云下载:mac版虚拟机 mac上genymotion.wind ...