Failed to resolve: play-services-tasks

后端 未结 5 1328
深忆病人
深忆病人 2020-12-05 18:25

I have been tryong to add FCM to my android application for almost 48 hours now. I am keep on failing with these two errors on Android Studio. I have tried all the solutions

相关标签:
5条回答
  • 2020-12-05 18:42

    jcenter() sometimes act as a mirror repository for some Google dependencies. During Gradle building process, it looks for dependencies in the first entry listed in your repositories {...} block. So if this repository is broken or something bad occurs with any dependency the process will fail.

    Here there is a recommended order for repository list

        repositories {
            google()
            maven {
                url 'https://maven.google.com/'
            }
            jcenter()
        }
    
    0 讨论(0)
  • 2020-12-05 18:45

    Add in your app.gradle

    allprojects {
        repositories {
            jcenter()
            maven {
                url "https://maven.google.com"
            }
        }
    }
    

    and upgrade your dependencies version.

    0 讨论(0)
  • 2020-12-05 19:02

    I had this occurring due to outdated build tools version. Updating from 28.0.2 to 28.0.3 resolved it.

    buildToolsVersion '28.0.2'
    

    to:

    buildToolsVersion '28.0.3'
    

    in build.gradle file.

    0 讨论(0)
  • 2020-12-05 19:04

    In gradle (project), just change the position of google() before jcenter(), and the error is gone.

    repositories {
        google()
        jcenter()
    }
    
    0 讨论(0)
  • 2020-12-05 19:05

    Put google() repository at the very first line of dependencies. It will work.

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