最新消息:20210917 已从crifan.com换到crifan.org

【已解决】Android Studio编译rcsjta出现gradle警告:Configuration compile is obsolete and has been replaced with implementation and api It will be removed soon

Android crifan 314浏览 0评论
折腾:
【未解决】Mac中用Android Studio打开rctjsa项目并编译apk和实时调试安卓手机小米9
期间,继续编译出现警告:
INFO: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: RI, api_cnx, core, cts_provider, cts_signature, notification, settings, tts
Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ and ‘api’
解决Configuration ‘compile’ is obsolete and has been replaced with implementation – 掘金
【我的Android进阶之旅】Configuration compile is obsolete and has been replaced with implementation and_欧阳鹏-CSDN博客_configuration debugcompile is obsolete and has b
Android Studio 3.1.0 – Configuration ‘compile’ is obsolete and has been replaced wit ‘implementation – Project Development Help and Advice – GitHub Support Community
android – Still getting warning : Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ – Stack Overflow
点击上述链接看看
添加构建依赖项  |  Android 开发者  |  Android Developers
依赖项配置
在 dependencies 代码块内,您可以从多种不同的依赖项配置中选择其一(如上面所示的 implementation)来声明库依赖项。每种依赖项配置都向 Gradle 提供了有关如何使用该依赖项的不同说明。下表介绍了您可以对 Android 项目中的依赖项使用的各种配置。此表还将这些配置与自 Android Gradle 插件 3.0.0 起弃用的配置进行了比较。
新配置
已弃用配置
行为
implementation
compile
Gradle 会将依赖项添加到编译类路径,并将依赖项打包到构建输出。不过,当您的模块配置 implementation 依赖项时,会让 Gradle 了解您不希望该模块在编译时将该依赖项泄露给其他模块。也就是说,其他模块只有在运行时才能使用该依赖项。
使用此依赖项配置代替 api 或 compile(已弃用)可以显著缩短构建时间,因为这样可以减少构建系统需要重新编译的模块数。例如,如果 implementation 依赖项更改了其 API,Gradle 只会重新编译该依赖项以及直接依赖于它的模块。大多数应用和测试模块都应使用此配置。
点击第一个RI,打开了:
RI/build.gradle
看到了 compile有删除线:
dependencies {
    compile project(':api')
    compile project(':api_cnx')
    compile project(':mediaplayer')
    compile 'com.android.support:support-v4:25.0.1'
   compile 'com.google.android.gms:play-services:8.4.0'
}
那去改为:implementation 试试
貌似没语法错误了。
点击Sync Now试试
果然就可以了。
再去依次改掉其他地方的
即可。
【总结】
此处Android Studio中提示Gradle配置有警告:
INFO: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: RI, api_cnx, core, cts_provider, cts_signature, notification, settings, tts
原因:
新版gradle,升级到
Android Gradle 插件 3.0.0
后,有不少改动,包括依赖项配置参数都不同了。
此处就有:
已废弃:compile
改为了:implementation
解决办法:
根据上面提示,点击对应项目按钮,进去对应gradle配置文件
把 compile 都改为 implementation
重新编译,即可。

转载请注明:在路上 » 【已解决】Android Studio编译rcsjta出现gradle警告:Configuration compile is obsolete and has been replaced with implementation and api It will be removed soon

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
93 queries in 0.315 seconds, using 23.42MB memory