解决Configuration 'compile' is obsolete and has been replaced with implementation

时间:2021-09-14 02:42:12

项目中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. poj 1806 分块模拟

    Manhattan 2025 Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 1318   Accepted: 703 Des ...

  2. POJ1815 Friendship(字典序最小最小割割边集)

    看了题解.当时也觉得用邻接矩阵挺好写的,直接memset:然而邻接矩阵不懂得改,于是就放开那个模板,写了Dinic.. 方法是,按字典序枚举每一条满流的边,然后令其容量减1,如果最大流改变了,这条边就 ...

  3. Codeforces Educational Codeforces Round 5 C. The Labyrinth 带权并查集

    C. The Labyrinth 题目连接: http://www.codeforces.com/contest/616/problem/C Description You are given a r ...

  4. led驅動芯片對LED燈具的要求

    1.LED驅動芯片直流額定輸入電壓范圍應當8 - 40 v,覆蓋廣泛的應用需求.最好的壓縮能力大于45 v.當輸入交流12 v.24 v,簡單的橋式整流器輸出電壓可以遵循電網電壓波動,特別是在高電壓輸 ...

  5. nyoj 523 亡命逃窜 【BFS】

    亡命逃窜 时间限制:1000 ms  |  内存限制:65535 KB 难度:4 描写叙述 从前有个叫hck的骑士,为了救我们漂亮的公主,潜入魔王的老巢,够英雄吧.只是英雄不是这么好当的.这个可怜的娃 ...

  6. Erich Gamma

    Erich Gamma是IBM的杰出工程师.他是Jazz项目的领头人之一,曾担任Eclipse的Java开发环境JDT项目的领导,目前是Eclipse的项目管理委员会成员.Erich也是经典书籍&lt ...

  7. iOS js oc相互调用(JavaScriptCore 下)

    下来我们使用js调用iOS js调用iOS分两种情况 一,js里面直接调用方法 二,js里面通过对象调用方法 首先我们看第一种,直接调用方法. 其中用到了iOS的block 上代码 -(void)we ...

  8. springMVC源码分析--AbstractDetectingUrlHandlerMapping(五)

    上一篇博客springMVC源码分析--AbstractUrlHandlerMapping(三)中我们介绍了AbstractUrlHandlerMapping,主要介绍了一个handlerMap的ur ...

  9. MyBatis之整合Spring

    MyBatis之整合Spring 整合思路: 1.SqlSessionFactory对象应该放到spring容器中作为单例存在 2.传统dao的开发方式中,应该从spring容器中获得sqlSessi ...

  10. axios中post传参方式

    最近做vue项目,做图片上传的功能,使用get给后台发送数据,后台能收到,使用post给后台发送图片信息的时候,vue axios post请求发送图片base64编码给后台报错HTTP 错误 414 ...