Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to resolve: play-services-tasks

Tags:

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 in this post. Still I couldn't fix it.

I want firebase cloud messaging to be integrated in my app. So I did the followings.

  • Created an app in the firebase console
  • Included the .json config file
  • Added the SDK
  • implementation 'com.google.firebase:firebase-messaging:17.0.0' (In the app level gradle)
  • apply plugin: 'com.google.gms.google-services' (In the app level gradle file last line)
  • classpath 'com.google.gms:google-services:4.0.1' (In the project level gradle)
  • Added the repository google() (In the project level gradle)

I have tried syncing many times and I keep on getting the error

Failed to resolve: play-services-tasks Open File

Failed to resolve: play-services-basement Open File

On a side note, I am using the gradle plugin 3.1.3

    classpath 'com.android.tools.build:gradle:3.1.3' 

Can someone please give me a hand here please.

like image 854
Fawzan Avatar asked Jun 20 '18 05:06

Fawzan


1 Answers

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

repositories {     google()     jcenter() } 
like image 175
Mike Yan Avatar answered Oct 03 '22 04:10

Mike Yan