Error :“Configuration 'compile' is obsolete and has been replaced with 'implementation'.”, even though no 'compile' present in gradle

后端 未结 6 511
离开以前
离开以前 2021-01-11 14:31

I have the following gradle files and I can\'t find anything which would still warrant the warning \"Configuration \'compile\' is obsolete and has been replace

相关标签:
6条回答
  • 2021-01-11 15:05

    Update to classpath version

    classpath 'com.android.tools.build:gradle:3.1.1'
    classpath 'com.google.gms:google-services:3.2.0'
    
    0 讨论(0)
  • 2021-01-11 15:08

    I think (but I'm not sure) that it's the implementation "com.google.firebase:firebase-core:$google_services_version" line, which resolves to 11.8.0. My suspicion comes from running ./gradlew app:dependencies.

    The output of that gives (among other things):

    compile - Compile dependencies for 'main' sources (deprecated: use 'implementation' instead).
    \--- com.google.firebase:firebase-core:11.8.0
         \--- com.google.firebase:firebase-analytics:11.8.0
              +--- com.google.android.gms:play-services-basement:11.8.0
              |    +--- com.android.support:support-v4:25.2.0
              |    |    +--- com.android.support:support-compat:25.2.0
              |    |    |    \--- com.android.support:support-annotations:25.2.0
              |    |    +--- com.android.support:support-media-compat:25.2.0
              |    |    |    +--- com.android.support:support-annotations:25.2.0
              |    |    |    \--- com.android.support:support-compat:25.2.0 (*)
              |    |    +--- com.android.support:support-core-utils:25.2.0
              |    |    |    +--- com.android.support:support-annotations:25.2.0
              |    |    |    \--- com.android.support:support-compat:25.2.0 (*)
              |    |    +--- com.android.support:support-core-ui:25.2.0
              |    |    |    +--- com.android.support:support-annotations:25.2.0
              |    |    |    \--- com.android.support:support-compat:25.2.0 (*)
              |    |    \--- com.android.support:support-fragment:25.2.0
              |    |         +--- com.android.support:support-compat:25.2.0 (*)
              |    |         +--- com.android.support:support-media-compat:25.2.0 (*)
              |    |         +--- com.android.support:support-core-ui:25.2.0 (*)
              |    |         \--- com.android.support:support-core-utils:25.2.0 (*)
              |    \--- com.google.android.gms:play-services-basement-license:11.8.0
              +--- com.google.firebase:firebase-common:11.8.0
              |    +--- com.google.android.gms:play-services-basement:11.8.0 (*)
              |    +--- com.google.android.gms:play-services-tasks:11.8.0
              |    |    +--- com.google.android.gms:play-services-basement:11.8.0 (*)
              |    |    \--- com.google.android.gms:play-services-tasks-license:11.8.0
              |    \--- com.google.firebase:firebase-common-license:11.8.0
              +--- com.google.firebase:firebase-analytics-impl:11.8.0
              |    +--- com.google.android.gms:play-services-basement:11.8.0 (*)
              |    +--- com.google.firebase:firebase-iid:11.8.0
              |    |    +--- com.google.android.gms:play-services-basement:11.8.0 (*)
              |    |    +--- com.google.firebase:firebase-common:11.8.0 (*)
              |    |    +--- com.google.android.gms:play-services-tasks:11.8.0 (*)
              |    |    \--- com.google.firebase:firebase-iid-license:11.8.0
              |    +--- com.google.firebase:firebase-common:11.8.0 (*)
              |    +--- com.google.android.gms:play-services-tasks:11.8.0 (*)
              |    \--- com.google.firebase:firebase-analytics-impl-license:11.8.0
              \--- com.google.firebase:firebase-analytics-license:11.8.0
    

    If that's the case, then we need to wait for an update to the firebase-core library.

    0 讨论(0)
  • 2021-01-11 15:18

    I had face same issue although i had replaced all 'compile' with 'implementation'. But finally resolved this issue by doing following changes in build.gradle(Project).I have replaced it

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

    with this line

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

    and after it, your gradle may give warnning again to add firebase-core than add this line in your build.gradle(app)

    dependencies{
    implementation 'com.google.firebase:firebase-core:16.0.3'
    } 
    

    Note: please check updated dependencies in any issue.

    0 讨论(0)
  • 2021-01-11 15:19

    I solved by changing classpath inside build.gradle (Project: your Project name)

    from 
      classpath 'com.google.gms:google-services:3.1.1' 
    to
      classpath 'com.google.gms:google-services:3.2.0'

    0 讨论(0)
  • 2021-01-11 15:23

    The problem lies in apply plugin: 'com.google.gms.google-services'

    The Google Services plugin is adding a dependency on behalf of you. Hopefully they fix it in the future.

    I copy answer from below stackoverflow link. https://stackoverflow.com/a/49059867/4782538. Thanks @Niklas for answer.

    0 讨论(0)
  • 2021-01-11 15:25

    I had this problem too, this is how I solved it:

    go to you build.gradle (app level)

    build.gradle module app

    and replace the word 'compile' with 'implementation'

    0 讨论(0)
提交回复
热议问题