为了账号安全,请及时绑定邮箱和手机立即绑定

如何解决这个“配置‘编译’已过时,已被‘实现’和‘api’取代。”

如何解决这个“配置‘编译’已过时,已被‘实现’和‘api’取代。”

斯蒂芬大帝 2022-07-27 16:39:46
当我尝试使用来自 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中被替换为apiimplementation

api将依赖项暴露给外部模块,就像这样compile 做一样。因此,如果您有模块A依赖于依赖的模块BC如果C发生更改,则A需要重新编译。Gradle 团队认识到这在很多情况下是不必要的,因此引入了implementationso if 如果C仅更改依赖于它的模块将不得不重新编译,这意味着只有 module B。这缩短了构建时间并使项目更加整洁。

简而言之,如果您将 all 替换compileapi结果将是相同的,这就是警告所针对的。

但是,根据经验,您希望implementation尽可能使用它来避免依赖项污染项目。

我会尝试首先替换compileimplementation构建项目。

链接对差异有更好的解释和可视化。


查看完整回答
反对 回复 2022-07-27
?
HUX布斯

TA贡献1876条经验 获得超6个赞

您可以更改此行compile 'com.applandeo:material-calendar-view:1.5.1'

对此implementation 'com.applandeo:material-calendar-view:1.5.1'


查看完整回答
反对 回复 2022-07-27
  • 2 回答
  • 0 关注
  • 141 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号