0

I have an old app that was running perfectly Now I want to add FCM notification.

This is build.gradle (Module: app)

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.google.android.gms:play-services:7.0.0'
    //compile 'com.google.firebase:firebase-messaging:10.0.1'
}

apply plugin: 'com.google.gms.google-services'

The first error I got was

Error:(37, 0) Version: 7.0.0 is lower than the minimum version (9.0.0) required for google-services plugin.

I changed the version to be 9.0.0

code has become like this

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.google.android.gms:play-services:9.0.0'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
}

apply plugin: 'com.google.gms.google-services'

but I got this error

All com.google.android.gms libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 9.0.0, 10.0.1. Examples include com.google.android.gms:play-services:9.0.0 and com.google.android.gms:play-services-basement:10.0.1 more... (Ctrl+F1)

for that I changed the to version 10.0.1 as mentioned

the code has become like this

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
}

apply plugin: 'com.google.gms.google-services'

Now I get this error

Error:(802, 97) error: cannot find symbol method getMap()

the getMap function used to work fine before,

I am not sure which version of com.google.android.gms:play-services I have to use.

Thanks

asmgx
  • 7,328
  • 15
  • 82
  • 143
  • use the libraries which is mentioned on documentation. – Noorul Dec 26 '16 at 11:46
  • I used com.google.firebase:firebase-messaging:10.0.1 as mentioned in the documentation yet the error is related to com.google.android.gms:play-services – asmgx Dec 26 '16 at 11:47

2 Answers2

1

The getMap function has been deprecated now.Check this link and use getMapAsync().And also keep the google services updated in the sdk manager.

Community
  • 1
  • 1
Arpan Sharma
  • 2,142
  • 11
  • 22
-1

Try this

compile 'com.google.android.gms:play-services:9.0.2'
Quick learner
  • 10,632
  • 4
  • 45
  • 55