代码之家  ›  专栏  ›  技术社区  ›  kgandroid m.qadhavi

“配置‘compile’已过时,已替换为‘implementation’和‘api’。”警告不断出现

  •  1
  • kgandroid m.qadhavi  · 技术社区  · 6 年前

    因此,经过大量研究后,我发布了以下内容:

    Android Studio build.gradle warning message Still getting warning : Configuration 'compile' is obsolete and has been replaced with 'implementation'

    但警告还在不断出现。

    这里是 :

    buildscript {
        repositories {
            google()
            jcenter()
            maven { url 'https://maven.fabric.io/public' }
            maven {
                url 'https://maven.google.com'
            }
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.3'
            classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
            classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.3'
            //classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
            classpath 'com.google.gms:google-services:3.2.0'
            classpath 'io.fabric.tools:gradle:1.22.1'
    
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
            maven { url 'https://jitpack.io' }
            maven { url 'https://maven.fabric.io/public' }
            maven {
                url 'https://maven.google.com'
            }
        }
    }
    

    这里是所有的图书馆 应用程序级别构建.gradle

    依赖项{

        implementation "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION"
        implementation "com.android.support:cardview-v7:$SUPPORT_LIBRARY_VERSION"
        implementation "com.android.support:design:$SUPPORT_LIBRARY_VERSION"
        implementation "com.android.support:gridlayout-v7:$SUPPORT_LIBRARY_VERSION"
        implementation "com.android.support:support-v4:$SUPPORT_LIBRARY_VERSION"
        implementation "com.android.support:recyclerview-v7:$SUPPORT_LIBRARY_VERSION"
        implementation "com.android.support:support-v13:$SUPPORT_LIBRARY_VERSION"
        implementation "com.android.support:customtabs:$SUPPORT_LIBRARY_VERSION"
        implementation "com.android.support:multidex:$MULTIDEX_VERSION"
    
        implementation("com.bottlerocketstudios:barcode:$BARCODE_VERSION@aar") {
            transitive = true;
        }
        implementation "com.bottlerocketstudios:javalockboxlib:$JAVALOCKBOXLIB_VERSION"
        implementation "com.bottlerocketstudios:vault:$VAULT_VERSION"
    
        implementation "com.github.bumptech.glide:glide:$GLIDE_VERSION"
        implementation "com.github.bumptech.glide:okhttp3-integration:$GLIDE_OKHTTP_VERSION@aar"
        implementation "com.squareup.okhttp3:logging-interceptor:$OKHTTP_LOGGER_VERSION"
    
        implementation "com.facebook.android:facebook-android-sdk:$FACEBOOK_SDK_VERSION"
    
        implementation "com.google.android.gms:play-services-auth:$PLAY_SERVICES_VERSION"
        implementation "com.google.android.gms:play-services-gcm:$PLAY_SERVICES_VERSION"
        implementation "com.google.android.gms:play-services-maps:$PLAY_SERVICES_VERSION"
        implementation "com.google.android.gms:play-services-location:$PLAY_SERVICES_VERSION"
    
        implementation "com.jakewharton:butterknife:$BUTTERKNIFE_VERSION"
        implementation "com.jakewharton.rxbinding:rxbinding:$RX_BINDING_VERSION"
        implementation "com.jakewharton.rxbinding:rxbinding-support-v4:$RX_BINDING_VERSION"
        implementation "com.jakewharton.rxbinding:rxbinding-appcompat-v7:$RX_BINDING_VERSION"
        implementation "com.jakewharton.rxbinding:rxbinding-design:$RX_BINDING_VERSION"
        implementation "com.jakewharton.rxbinding:rxbinding-recyclerview-v7:$RX_BINDING_VERSION"
        implementation "com.jakewharton.threetenabp:threetenabp:$THREETENABP_VERSION"
        implementation "com.jakewharton.timber:timber:$TIMBER_VERSION"
        implementation "com.jakewharton:process-phoenix:$PROCESS_PHEONIX_VERSION"
    
        annotationProcessor "com.squareup.dagger:dagger-compiler:$DAGGER_VERSION"
        implementation "com.squareup.dagger:dagger:$DAGGER_VERSION"
        implementation "com.squareup.retrofit2:retrofit:$RETROFIT_VERSION"
        implementation "com.squareup.retrofit2:adapter-rxjava:$RETROFIT_VERSION"
    
        implementation "com.f2prateek.rx.preferences:rx-preferences:$RX_PREFERENCES_VERSION"
        implementation "com.trello:rxlifecycle:$RX_LIFECYCLE_VERSION"
        implementation "com.trello:rxlifecycle-components:$RX_LIFECYCLE_VERSION"
        implementation "io.reactivex:rxjava:$RX_JAVA_VERSION"
        implementation "io.reactivex:rxandroid:$RX_ANDROID_VERSION"
    
        implementation "pl.charmas.android:android-reactive-location:$REACTIVE_LOCATION_VERSION@aar"
        implementation("com.crashlytics.sdk.android:crashlytics:$CRASHLYTICS_VERSION@aar") {
            transitive = true;
        }
        implementation "com.contentful.java:java-sdk:$CONTENTFUL_JAVA_SDK_VERSION"
        implementation "uk.co.chrisjenx:calligraphy:$CALLIGRAPHY_VERSION"
        implementation "com.flurry.android:analytics:$FLURRY_ANALYTICS_VERSION"
    
    
        implementation 'org.jsoup:jsoup:1.11.1'
    
        testImplementation "junit:junit:$JUNIT_VERSION"
    }
    

    OKHTTP_VERSION=3.8.1
    RX_PREFERENCES_VERSION=1.0.0
    PLAY_SERVICES_VERSION=15.0.1
    BARCODE_VERSION=1.0.3
    CONTENTFUL_JAVA_SDK_VERSION=7.5.0
    BRFONTVIEW_VERSION=1.0.0
    JUNIT_VERSION=4.12
    BUTTERKNIFE_VERSION=7.0.1
    DAGGER_VERSION=1.2.2
    RX_ANDROID_VERSION=1.0.1
    RX_JAVA_VERSION=1.0.14
    JAVALOCKBOXLIB_VERSION=1.0.0
    RX_BINDING_VERSION=0.3.0
    CALLIGRAPHY_VERSION=2.1.0
    SUPPORT_LIBRARY_VERSION=28.0.0-beta01
    RX_LIFECYCLE_VERSION=0.2.0
    REACTIVE_LOCATION_VERSION=0.8
    RETROFIT_VERSION=2.3.0
    CRASHLYTICS_VERSION=2.6.2
    FACEBOOK_SDK_VERSION=4.23.0 
    

    我得到的警告是:

    Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
    It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
    
    
    Configuration 'debugCompile' is obsolete and has been replaced with 'debugImplementation' and 'debugApi'.
    It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
    

    知道是哪一个导致了问题。

    4 回复  |  直到 6 年前
        1
  •  3
  •   Rishabh Saxena    6 年前

    compile 具有 implementation

    testCompile testImplementation

    debugCompile 具有 debugImplementation

    androidTestCompile 具有 androidTestImplementation

    compileOnly

    Gradle3.0的变化正式发布 announced at GoogleIO17 .

    编译 配置现在已弃用,应替换为 实施 api

    查看Gradle文档 here

    您收到的警告是由于您导入的库正在使用 编译

        2
  •  3
  •   kgandroid m.qadhavi    6 年前

    问题是我在应用程序中使用的jakewhartonhugo插件

    classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
    

    相关链接:

    https://github.com/JakeWharton/hugo/issues/156

        3
  •  0
  •   Sana    6 年前

        4
  •  0
  •   Mohd Qasim    6 年前

    只需替换compile-->app module中的实现,app module中的compileSdkVersion除外

        5
  •  0
  •   virsha    5 年前

    'com.google.gms:google-services:3.1.0' 'com.google.gms:google-services:4.0.1'