当我尝试使用来自 GitHub 的问题时。我放弃了配置“编译”已过时,已替换为“实施”和“API”。我尝试使用材料日历视图我的毕业典礼: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'}
2 回答

慕标5832272
TA贡献1966条经验 获得超4个赞
在后来的 gradle 版本compile
中被替换为api
和implementation
。
api
将依赖项暴露给外部模块,就像这样compile
做一样。因此,如果您有模块A
依赖于依赖的模块B
,C
如果C
发生更改,则A
需要重新编译。Gradle 团队认识到这在很多情况下是不必要的,因此引入了implementation
so if 如果C
仅更改依赖于它的模块将不得不重新编译,这意味着只有 module B
。这缩短了构建时间并使项目更加整洁。
简而言之,如果您将 all 替换compile
为api
结果将是相同的,这就是警告所针对的。
但是,根据经验,您希望implementation
尽可能使用它来避免依赖项污染项目。
我会尝试首先替换compile
并implementation
构建项目。
此链接对差异有更好的解释和可视化。

HUX布斯
TA贡献1876条经验 获得超6个赞
您可以更改此行compile 'com.applandeo:material-calendar-view:1.5.1'
对此implementation 'com.applandeo:material-calendar-view:1.5.1'
添加回答
举报
0/150
提交
取消