android - Gradle警告我的build.gradle文件中不存在的配置

标签 android gradle

Gradle发出警告:

Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.



我的build.gradle文件中没有“编译”配置,为什么它会向我发出此警告?
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'realm-android'

android {
    compileSdkVersion 25
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "com.ktoi.toi"
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
}
kapt {
    generateStubs = true
}
buildscript {
    ext.supportVersion = '25.0.0'
    ext.daggerVersion = '2.7'
    ext.retrofitVersion = '2.1.0'
    ext.rxVersion = '1.2.1'
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath "io.realm:realm-gradle-plugin:2.1.1"
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:25.0.0'
    testImplementation 'junit:junit:4.12'
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation "com.android.support:cardview-v7:${supportVersion}"
    implementation "com.android.support:design:${supportVersion}"

    // Dagger 2
    implementation "com.google.dagger:dagger:${daggerVersion}"
    kapt "com.google.dagger:dagger-compiler:${daggerVersion}"
    compileOnly "org.glassfish:javax.annotation:3.1.1"

    //Retrofit 2
    implementation "com.squareup.retrofit2:retrofit:${retrofitVersion}"
    implementation "com.squareup.retrofit2:adapter-rxjava:${retrofitVersion}"
    implementation "com.squareup.retrofit2:converter-gson:${retrofitVersion}"

    implementation 'com.google.code.gson:gson:2.8.0'

    implementation "io.reactivex:rxjava:${rxVersion}"
    implementation "io.reactivex:rxandroid:${rxVersion}"

    implementation 'com.github.bumptech.glide:glide:3.7.0'

  }
repositories {
    mavenCentral()
}

最佳答案

realm-gradle-plugin:2.1.1较旧,old versions of the plugin add compile dependencies。较新版本的插件正确add api dependencies in place of compile if your project has those

截至目前,5.8.0是bintray的最新版本。

关于android - Gradle警告我的build.gradle文件中不存在的配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53882807/

相关文章:

Android - 处理后退按钮

android - 如何绘制填充多边形? [Android、Andengine]

java - Android - 媒体播放器错误 : attachnewplayer called in state 64

java - IntelliJ 在项目结构中显示额外的名称

Android:延迟 AudioTrack

android - 无法在 colors.xml 文件中创建新颜色项

android - 如何在 gradle 脚本中获取 Running Android Flavor Name

android - 更新 Gradle 插件后 Android maven 发布 Artifact 错误

maven - 如何通过Gradle将所有依赖项复制到Maven存储库?

java - 附近的 Hamcrest 无法使用