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

当我尝试使用来自 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'


}



斯蒂芬大帝
浏览 142回答 2
2回答

慕标5832272

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

HUX布斯

您可以更改此行compile 'com.applandeo:material-calendar-view:1.5.1'对此implementation 'com.applandeo:material-calendar-view:1.5.1'
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java