How to apply the new Android Studio dependency settings?

4

I just updated Android Studio and I received several warnings saying that the following settings had changed:

  • compile
  • provided
  • apk

The warning messages were like this:

  

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:    link

After reading what this link says , I corrected (or so I think) my file gradle in the following way:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.25.1'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "org.deiverbum.liturgiacatolica"
        minSdkVersion 21
        targetSdkVersion 26
        versionName '1.3 (beta)'
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        versionCode 1
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            debuggable true
        }
    }
    productFlavors {
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
        transitive = true
    }
    implementation 'com.android.support:appcompat-v7:26.1.0'

    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.volley:volley:1.1.0'
    implementation 'com.google.code.gson:gson:2.8.0'
    implementation 'com.google.firebase:firebase-database:11.8.0'
    implementation 'com.google.firebase:firebase-messaging:11.8.0'
    implementation 'com.google.firebase:firebase-core:11.8.0'
    implementation 'com.google.firebase:firebase-crash:11.8.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.google.android:flexbox:0.2.5'
    implementation 'com.google.android:flexbox:0.3.0-alpha1'
    implementation 'com.google.firebase:firebase-invites:11.8.0'
    testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

After updating the file, the app compiles without errors and almost all the warnings disappeared, except one:

  

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

The warning sends me to the file build.gradle of the folder app (the one I've shared above). As you can see, I have changed all compile by implementation . Currently, the word compile appears only here: compileSdkVersion 26 ... I have tried to change it to implementationSdkVersion 26 and% apiSdkVersion 26 . In both cases it gives an error.

As I said, the app works, but I always have that annoying warning and I would like to know what should be done to remove it.

    
asked by A. Cedano 15.04.2018 в 22:29
source

1 answer

5

I found the solution to my problem, doing the indicated in this answer .

Here I put what I have done, in case it can be useful to someone in the future:

It was about changing the following in the dependencies section of the file build.gradle of the project , (the general), not that of the app:

    classpath 'com.google.gms:google-services:3.1.1'

for

    classpath 'com.google.gms:google-services:3.2.0'

With this the warning has disappeared.

The question is to change the version of google-services of the 3.1.1 (or another lower that you can have), to the version 3.2.0 (or another superior, when these exist in the future).

    
answered by 22.04.2018 / 23:29
source