[英]build.gradle compile deprecated warning
I'm trying to run an old project of mine on android studio, the project was last edited in 2017 and since then haven't been touched. 我试图在android studio上运行我的一个老项目,该项目的最后一次编辑是在2017年,从那时以来一直没有被触及。
i keep getting an error to change the "compile" to "implementation" in the gradle file which i have done and still i keep getting the same warning 我一直在将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"
this is the actual code in the gradle file 这是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'
it should build successfully without this warning, what am i doing wrong here? 它应该在没有此警告的情况下成功构建,我在这里做错了什么?
You can try this: Go to File > Sync project with Gradle Files 您可以尝试以下操作:转到“文件”>“与Gradle文件同步项目”
Then with the system finishes Sync 然后与系统完成同步
Go to File > Invalidate cache and Restart 转到文件>使缓存无效并重新启动
Hope it works 希望能奏效
Though i don't see any problem with your dependency list, use debug logs to identify which dependency is reason for this. 虽然我看不到您的依赖项列表有任何问题,但是请使用调试日志来确定哪个依赖项是造成这种情况的原因。 Compile using command line and collect logs in some file. 使用命令行进行编译,并在某些文件中收集日志。
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")
My example output 我的示例输出
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
i was using a very old version of realm in my project 我在项目中使用了非常旧的领域版本
classpath "io.realm:realm-gradle-plugin:2.2.1"
after updating to 更新到
classpath "io.realm:realm-gradle-plugin:5.12.0"
the warning was gone and everything working again 警告消失了,一切又恢复了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.