[英]How to solve this “Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.”
When I try use issue from GitHub. 当我尝试使用来自GitHub的问题时。 I give in out 我让步
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. 配置“编译”已过时,已被“实现”和“ api”替换。
I try use Material Calendar View 我尝试使用材料日历视图
My gradle: 我的gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.mederov.timelord"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile 'com.applandeo:material-calendar-view:1.5.1'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
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:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.github.bumptech.glide:glide:4.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
implementation 'de.hdodenhof:circleimageview:3.0.0'
}
You can change this line compile 'com.applandeo:material-calendar-view:1.5.1'
您可以更改此行, compile 'com.applandeo:material-calendar-view:1.5.1'
to this implementation 'com.applandeo:material-calendar-view:1.5.1'
此implementation 'com.applandeo:material-calendar-view:1.5.1'
In the later gradle versions compile
was replaced with both api
and implementation
. 在后来的gradle版本中, compile
被api
和implementation
所取代。
api
exposes the dependencies to external modules, just like compile
does. api
像compile
一样将依赖项公开给外部模块。 So if you have module A
depends on module B
which depends on C
, if C
changes, then A
needs to be recompiled. 因此,如果您的模块A
依赖于模块B
,而模块B
依赖于C
,则如果C
更改,则需要重新编译A
The Gradle team recognized this was unnecessary in a lot of cases, so it introduced implementation
so if C
changes only modules that depend on it will have to recompile, which means only module B
. Gradle团队认识到在很多情况下这是不必要的,因此它引入了implementation
因此,如果C
仅更改依赖于它的模块,则必须重新编译,这意味着仅模块B
This shortens build times and makes the project much more tidy. 这缩短了构建时间,并使项目更加整洁。
In short, if you replace all compile
with api
the result will be the same and that's what the warning is hitting at. 简而言之,如果将所有compile
替换为api
,结果将相同,这就是警告的内容。
However, as a rule of thumb you'd want to use implementation
whenever possible to avoid polluting the project with dependencies. 但是,作为经验法则,您希望在任何可能的地方都使用implementation
以避免对依赖项造成污染。
I'd try to first replace compile
with implementation
and build the project. 我会尝试先用implementation
代替compile
并构建项目。
This link has a much better explanation and visualization of the differences. 该链接可以更好地说明和显示差异。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.