Android build.gradle编译不推荐的警告

Android build.gradle编译不推荐的警告,android,android-studio,android-gradle-plugin,Android,Android Studio,Android Gradle Plugin,我正试图在android studio上运行我的一个老项目,该项目上次编辑是在2017年,从那以后就再也没有被触动过 我一直收到一个错误,将gradle文件中的“compile”更改为“implementation”,我已经这样做了,但仍然收到相同的警告 "WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed a

我正试图在android studio上运行我的一个老项目,该项目上次编辑是在2017年,从那以后就再也没有被触动过

我一直收到一个错误,将gradle文件中的“compile”更改为“implementation”,我已经这样做了,但仍然收到相同的警告

"WARNING: Configuration 'compile' is obsolete and has been replaced 
with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: 
http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: app"
这是gradle文件中的实际代码

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:recyclerview-v7:27.1.1'
它应该在没有此警告的情况下成功构建,我在这里做错了什么?

您可以试试

只是更新

gms:googleservices

您可以尝试以下方法: 转到文件>将项目与渐变文件同步

然后与系统完成同步

转到文件>使缓存无效并重新启动


希望它能工作

尽管我看不出您的依赖项列表有任何问题,但请使用调试日志来确定哪个依赖项是导致此问题的原因。 使用命令行编译并在某些文件中收集日志

gradlew assembleDebug --debug > abc_1.txt

println("....1")
implementation fileTree(dir: 'libs', include: ['*.jar'])
println("....2")
implementation 'com.android.support:appcompat-v7:27.1.1'
println("....3")
testImplementation 'junit:junit:4.12'
println("....4")
androidTestImplementation 'com.android.support.test:runner:1.0.2'
println("....5")
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
println("....6")
implementation 'com.android.support:appcompat-v7:27.1.1'
println("....7")
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
println("....8")
implementation 'com.android.support:recyclerview-v7:27.1.1'
println("....9")
我的示例输出

10:22:23.633 [QUIET] [system.out] ...1
10:22:23.633 [QUIET] [system.out] ...2
10:22:23.634 [QUIET] [system.out] ...3
10:22:23.634 [QUIET] [system.out] ...4
10:22:23.634 [QUIET] [system.out] ...5
10:22:23.634 [QUIET] [system.out] ...6
10:22:23.635 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Execute container callback action' started
10:22:23.635 [WARN] [org.gradle.api.Project] WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
10:22:23.635 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Execute container callback action'
10:22:23.635 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Execute container callback action' completed
10:22:23.635 [QUIET] [system.out] ...7
10:22:23.635 [QUIET] [system.out] ...8
10:22:23.636 [QUIET] [system.out] ...9
10:22:23.636 [QUIET] [system.out] ...10

我在我的项目中使用了一个非常旧的realm版本

classpath "io.realm:realm-gradle-plugin:2.2.1"
更新到之后

classpath "io.realm:realm-gradle-plugin:5.12.0"

警告消失了,一切都恢复正常

尝试构建和重建。我尝试了构建/重建,清理缓存并使其无效,然后重新启动,meTried更新所有过时的gradle stuff@MahmoudOmara都不起作用?您是否在
构建中使用了另一个插件。gradle
?^是的,我找到了解决方案,它与我项目中的另一个插件有关,我使用的是非常旧版本的realm数据库