1

So I am posting this after much research:

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

As many of the solutions suggested,I upgraded my google-services version to 3.2.0. Still the warning is coming up.

N.B. My project is using a lot of libraries:

Here is project level build.gradle:

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'
        }
    }
}

Here are all the libraries in app level build.gradle

dependencies {

    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"
}

Here are some important library version I am using :

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 

The warning I am getting:

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

Any idea which one is causing the problem.

kgandroid
  • 5,507
  • 5
  • 39
  • 69

5 Answers5

3

Just replace:

compile with implementation

testCompile with testImplementation

debugCompile with debugImplementation

androidTestCompile with androidTestImplementation

compileOnly is still valid. It was added in 3.0 to replace provided and not compile.

Changes with Gradle 3.0 is officially announced at GoogleIO17.

The compile configuration is now deprecated and should be replaced by implementation or api

Check out Gradle Documentation here

Warning you are getting is due to the libraries you have imported are you using compile keyword in the gardle.

Rishabh Saxena
  • 1,765
  • 15
  • 26
3

The problem is with jakewharton hugo plugin which I was using in the app

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

Relevant link:

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

kgandroid
  • 5,507
  • 5
  • 39
  • 69
0

With the hot key "CTRL + Shift + F" try to search for "compile" keyword.If there is no modification left, please go to file -> Invalidate Caches/Restart.These error messages will be gone.

Sana
  • 456
  • 3
  • 9
  • Done that a multiple times.After all those basic things are not working,I posted here – kgandroid Sep 10 '18 at 07:14
  • Then if these warnings are not creating any issue to run your app, you can ignore them.Sometimes these warning comes in android studio again and again – Sana Sep 10 '18 at 07:16
  • I need to resolve those to set up firebase and also to make my app clean and latest. – kgandroid Sep 10 '18 at 07:17
  • Is it stopping your app to run? – Sana Sep 10 '18 at 07:17
  • This will not enable you to setup firebase directly from the android studio itself.Also as a developer you dont want to have warnings in your code. – kgandroid Sep 10 '18 at 07:19
  • Really I will not want any warning in my code.Actually after the last gradle update these warnings come though we modify in specific locations.After sometime these warnings does not come.But it should not be a issue to set up the firebase.As you have posted I can see your code is clean and you do not need to modify the app.gradle file. – Sana Sep 10 '18 at 07:21
0

just replace compile-->implementation in app module, except compileSdkVersion in app module

Mohd Qasim
  • 896
  • 9
  • 20
0

The solution is to upgrade 'com.google.gms:google-services:3.1.0' to 'com.google.gms:google-services:4.0.1'

virsha
  • 1,140
  • 4
  • 19
  • 40