我收到错误消息:配置“编译"已过时并已被“实现"替换.将于 2018 年底移除 [英] I am getting error: Configuration 'compile' is obsolete and has been replaced with 'implementation'. It will be removed at the end of 2018
问题描述
我在更新 Android Gradle 插件和 Android Studio 后收到此错误.
I got this error after an update of Android Gradle plugin and Android Studio.
我已经检查了这个问题(Android Studio build.gradle 警告消息),但我无法运行该项目.
I have checked this question (Android Studio build.gradle warning message), but I am not able to run the project.
推荐答案
分步解决方案
1- 转到 build.gradle(module app)
1- Go to the build.gradle(module app)
2- 在依赖中,你会看到这样的代码
2- In the dependencies, you will see the code like this
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:design:23.3.0'
3- 现在您必须仅替换 compile 与 implementation 和 testCompile 与 testImplementation.像这样
3- Now you have to ONLY replace the compile with implementation and testCompile with testImplementation. Like this
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:23.3.0'
implementation 'com.android.support:support-v4:23.3.0'
implementation 'com.android.support:design:23.3.0'
4- 仅此而已.现在点击立即同步按钮.
4- That's all. Now click on Sync Now button.
注意- 不要更改代码中指定的编号或版本.
Note- Don't change the number or version given specified in the code.
这篇关于我收到错误消息:配置“编译"已过时并已被“实现"替换.将于 2018 年底移除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!