zoukankan      html  css  js  c++  java
  • 解决Configuration 'compile' is obsolete and has been replaced with implementation

    项目中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
    来源:掘金
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
  • 相关阅读:
    如何理解css3 -webkit-animation-fill-mode属性值为both时的使用方法
    关于对canvas.beginPath()的理解
    [cf10E]Greedy Change
    [atAGC055B]ABC Supremacy
    [loj6734]图上的游戏
    [gym102412D]The Jump from Height of Self-importance to Height of IQ Level
    [Aizu1410]Draw in Straight Lines
    [Aizu2993]Invariant Tree
    [zoj3990]Tree Equation
    [hdu6326]Monster Hunter
  • 原文地址:https://www.cnblogs.com/lwbqqyumidi/p/10699916.html
Copyright © 2011-2022 走看看