fechanique / cordova-plugin-fcm

Google FCM Push Notifications Cordova Plugin
624 stars 998 forks source link

Plugin Google Map and FCM conflict #413

Open usama-ayub opened 6 years ago

usama-ayub commented 6 years ago

Found com.google.android.gms:play-services-maps:11.+, but version 9.0.0 is needed for the google-services plugin.

Cannot add task ':processDebugGoogleServices' as a task with that name already exists.

usama-ayub commented 6 years ago

Step 1 (for FCM Plugin)

Comment out these lines in the FCMPlugin.gradle file.

classpath 'com.google.gms:google-services:3.0.0' apply plugin: com.google.gms.googleservices.GoogleServicesPlugin

Step 2 (for FCM Plugin)

Change the plugin.xml of the FCM plugin.

framework src="com.google.firebase:firebase-core:9.8.0" framework src="com.google.firebase:firebase-messaging:9.8.0"

Step 3 (for Cordova-googlemap)

framework src="com.google.android.gms:play-services-maps:9.0.0" framework src="com.google.android.gms:play-services-location:9.0.0"

Step 4

Remove and re-add plattform.

Step 5 (build.gradle file of the android platform folder)

Add this line to the classpath section classpath 'com.google.gms:google-services:3.1.0'

dependencies { compile fileTree(dir: 'libs', include: '*.jar') // SUB-PROJECT DEPENDENCIES START debugCompile(project(path: "CordovaLib", configuration: "debug")) releaseCompile(project(path: "CordovaLib", configuration: "release")) compile "com.google.android.gms:play-services-maps:9.8.0" compile "com.google.android.gms:play-services-location:9.8.0" compile "com.google.firebase:firebase-core:9.8.0" compile "com.google.firebase:firebase-messaging:9.8.0" // SUB-PROJECT DEPENDENCIES END } And add this line below the dependencies, nearly at the bottom of the file apply plugin: 'com.google.gms.google-services'

i found this solution and also thanks @troovers

shadow1349 commented 6 years ago

@usama-ayub I am getting this error and I don't have google map plugin installed. I follow your steps and I get:

A problem occurred evaluating root project 'android'. Failed to apply plugin [id 'com.google.gms.google-services'] For input string: "+"

usama-ayub commented 6 years ago

@shadow1349 can provide me list of plugin you have used

shadow1349 commented 6 years ago

The conflict was with the cordova-plugin-facebookads. I removed facebookads plugin and it worked just fine. However, I will need to re-add facebook ads so I can actually get some money from my app

pimatco commented 6 years ago

Trying to use FCM on Ionic v3.19.1and Cordova 7.1.0. Struggling to get a solution. Tried thousands of them and can't find the issue.

When I downgrade to 9.0.0 it shows me an error like this: (shorter for brevity but it has more than 76 errors:

platforms\android\src\plugin\google\maps\PluginMap.java:54: error: cannot find symbol
import com.google.android.gms.maps.model.MapStyleOptions;
                                        ^
  symbol:   class MapStyleOptions
  location: package com.google.android.gms.maps.model
platforms\android\src\plugin\google\maps\PluginMap.java:84: error: cannot find symbol

    GoogleMap.OnCameraIdleListener, GoogleMap.OnCameraMoveCanceledListener,
             ^
  symbol:   class OnCameraIdleListener
  location: class GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:84: error: cannot find symbol
    GoogleMap.OnCameraIdleListener, GoogleMap.OnCameraMoveCanceledListener,
                                             ^
  symbol:   class OnCameraMoveCanceledListener
  location: class GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:85: error: cannot find symbol
    GoogleMap.OnCameraMoveListener, GoogleMap.OnCameraMoveStartedListener,
             ^
  symbol:   class OnCameraMoveListener
  location: class GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:85: error: cannot find symbol
    GoogleMap.OnCameraMoveListener, GoogleMap.OnCameraMoveStartedListener,
                                             ^
  symbol:   class OnCameraMoveStartedListener
  location: class GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:86: error: cannot find symbol
    GoogleMap.OnInfoWindowLongClickListener, GoogleMap.OnInfoWindowCloseListener, GoogleMap.OnMyLocationClickListener, GoogleMap.OnPoiClickListener {
                                                                                           ^
  symbol:   class OnMyLocationClickListener
  location: class GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:86: error: cannot find symbol
    GoogleMap.OnInfoWindowLongClickListener, GoogleMap.OnInfoWindowCloseListener, GoogleMap.OnMyLocationClickListener, GoogleMap.OnPoiClickListener {
                                                                                                                                ^
  symbol:   class OnPoiClickListener
  location: class GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:268: error: cannot find symbol
                MapStyleOptions styleOptions = new MapStyleOptions(styles);
                ^
  symbol: class MapStyleOptions
platforms\android\src\plugin\google\maps\PluginMap.java:268: error: cannot find symbol
                MapStyleOptions styleOptions = new MapStyleOptions(styles);
                                                   ^
  symbol: class MapStyleOptions
platforms\android\src\plugin\google\maps\PluginMap.java:314: error: cannot find symbol
                    map.setMinZoomPreference((float)zoom.getDouble("minZoom"));
                       ^
  symbol:   method setMinZoomPreference(float)
  location: variable map of type GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:317: error: cannot find symbol
                    map.setMaxZoomPreference((float)zoom.getDouble("maxZoom"));
                       ^
  symbol:   method setMaxZoomPreference(float)
  location: variable map of type GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:323: error: cannot find symbol
              map.setOnCameraIdleListener(PluginMap.this);
                 ^
  symbol:   method setOnCameraIdleListener(PluginMap)
  location: variable map of type GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:324: error: cannot find symbol
              map.setOnCameraMoveCanceledListener(PluginMap.this);
                 ^
  symbol:   method setOnCameraMoveCanceledListener(PluginMap)
  location: variable map of type GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:325: error: cannot find symbol
              map.setOnCameraMoveListener(PluginMap.this);

                 ^
  symbol:   method setOnCameraMoveListener(PluginMap)
  location: variable map of type GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:326: error: cannot find symbol
              map.setOnCameraMoveStartedListener(PluginMap.this);
                 ^
  symbol:   method setOnCameraMoveStartedListener(PluginMap)
  location: variable map of type GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:337: error: cannot find symbol
              map.setOnMyLocationClickListener(PluginMap.this);
                 ^
  symbol:   method setOnMyLocationClickListener(PluginMap)
  location: variable map of type GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:338: error: cannot find symbol

              map.setOnPoiClickListener(PluginMap.this);
                 ^
  symbol:   method setOnPoiClickListener(PluginMap)
  location: variable map of type GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:379: error: cannot find symbol
                      map.setOnCameraIdleListener(new GoogleMap.OnCameraIdleListener() {
                                                               ^
  symbol:   class OnCameraIdleListener
  location: class GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:398: error: cannot find symbol
                  map.setOnCameraIdleListener(new GoogleMap.OnCameraIdleListener() {
                                                           ^
  symbol:   class OnCameraIdleListener
  location: class GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:432: error: cannot find symbol
      mapView.onStart();
             ^
  symbol:   method onStart()
  location: variable mapView of type MapView
platforms\android\src\plugin\google\maps\PluginMap.java:440: error: cannot find symbol
      mapView.onStop();
             ^
  symbol:   method onStop()
  location: variable mapView of type MapView
platforms\android\src\plugin\google\maps\PluginMap.java:755: error: cannot find symbol
                  map.setOnCircleClickListener(null);
                     ^
  symbol:   method setOnCircleClickListener(<null>)
  location: variable map of type GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:757: error: cannot find symbol
                  map.setOnCameraIdleListener(null);
                     ^
  symbol:   method setOnCameraIdleListener(<null>)
  location: variable map of type GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:758: error: cannot find symbol
                  map.setOnCameraMoveCanceledListener(null);
                     ^
  symbol:   method setOnCameraMoveCanceledListener(<null>)
  location: variable map of type GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:759: error: cannot find symbol
                  map.setOnCameraMoveListener(null);
                     ^
  symbol:   method setOnCameraMoveListener(<null>)
  location: variable map of type GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:768: error: cannot find symbol
                  map.setOnMyLocationClickListener(null);
                     ^
  symbol:   method setOnMyLocationClickListener(<null>)
  location: variable map of type GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:769: error: cannot find symbol
                  map.setOnPoiClickListener(null);
                     ^
  symbol:   method setOnPoiClickListener(<null>)
  location: variable map of type GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:836: error: cannot find symbol
    String markerTag = (String) marker.getTag();
                                      ^
  symbol:   method getTag()
  location: variable marker of type Marker
platforms\android\src\plugin\google\maps\PluginMap.java:866: error: cannot find symbol
    if ((marker.getTag() + "").startsWith("markercluster_")){
               ^
  symbol:   method getTag()
  location: variable marker of type Marker
platforms\android\src\plugin\google\maps\PluginMap.java:1054: error: cannot find symbol
    String markerTag = (String) marker.getTag();
                                      ^
  symbol:   method getTag()
  location: variable marker of type Marker
platforms\android\src\plugin\google\maps\PluginMap.java:1078: error: cannot find symbol
          if ((marker.getTag() + "").startsWith("markercluster_")){
                     ^
  symbol:   method getTag()
  location: variable marker of type Marker
platforms\android\src\plugin\google\maps\PluginMap.java:1206: error: cannot find symbol
          MapStyleOptions styleOptions = new MapStyleOptions(results.styles);
          ^
  symbol: class MapStyleOptions
platforms\android\src\plugin\google\maps\PluginMap.java:1206: error: cannot find symbol
          MapStyleOptions styleOptions = new MapStyleOptions(results.styles);
                                             ^
  symbol: class MapStyleOptions
platforms\android\src\plugin\google\maps\PluginMap.java:1249: error: cannot find symbol
                map.setMinZoomPreference((float)zoom.getDouble("minZoom"));
                   ^
  symbol:   method setMinZoomPreference(float)
  location: variable map of type GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:1252: error: cannot find symbol
                map.setMaxZoomPreference((float)zoom.getDouble("maxZoom"));
                   ^
  symbol:   method setMaxZoomPreference(float)
  location: variable map of type GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:1550: error: cannot find symbol
                  map.setOnCameraIdleListener(new GoogleMap.OnCameraIdleListener() {
                                                           ^
  symbol:   class OnCameraIdleListener
  location: class GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:1586: error: cannot find symbol
                  map.setOnCameraIdleListener(new GoogleMap.OnCameraIdleListener() {
                                                           ^
  symbol:   class OnCameraIdleListener
  location: class GoogleMap
platforms\android\src\plugin\google\maps\PluginMap.java:2117: error: cannot find symbol
    String clusterId_markerId = marker.getTag() + "";
                                      ^
  symbol:   method getTag()
  location: variable marker of type Marker
platforms\android\src\plugin\google\maps\PluginMap.java:2172: error: cannot find symbol
    String markerTag = marker.getTag() + "";
                             ^
  symbol:   method getTag()
  location: variable marker of type Marker
platforms\android\src\plugin\google\maps\PluginMap.java:2185: error: cannot find symbol

    if ((marker.getTag() + "").startsWith("markercluster_")){
               ^
  symbol:   method getTag()
  location: variable marker of type Marker
platforms\android\src\plugin\google\maps\PluginMap.java:2197: error: cannot find symbol
    if ((marker.getTag() + "").startsWith("markercluster_")){
               ^
  symbol:   method getTag()
  location: variable marker of type Marker

When I add the google-services plugin at the bottom of the file and versions at 9.8.0 like yoursit returns this:

BUILD FAILED

Total time: 1.414 secs
FAILURE: Build failed with an exception.

* Where:
Build file 'platforms\android\build.gradle' line: 335

* What went wrong:
A problem occurred evaluating root project 'android'.
> Plugin with id 'com.google.gms.google-services' not found.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* Where:
Build file 'platforms\android\build.gradle' line: 335

* What went wrong:
A problem occurred evaluating root project 'android'.
> Plugin with id 'com.google.gms.google-services' not found.

This is my project.properties

target=android-26
android.library.reference.1=CordovaLib
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.gradle.include.1=cordova-plugin-background-fetch/app-build.gradle
cordova.gradle.include.2=cordova-plugin-badge/app-badge.gradle
cordova.system.library.2=com.google.firebase:firebase-core:9.8.0
cordova.system.library.3=com.google.firebase:firebase-messaging:9.8.0
cordova.gradle.include.3=cordova-plugin-fcm/app-FCMPlugin.gradle
cordova.system.library.4=com.google.android.gms:play-services-location:9.8.0
cordova.system.library.5=com.google.android.gms:play-services-analytics:9.8.0
cordova.gradle.include.4=cordova-plugin-googlemaps/app-build-extras.gradle
cordova.gradle.include.5=cordova-plugin-googlemaps/app-tbxml-android.gradle
cordova.system.library.6=com.google.android.gms:play-services-maps:9.8.0
cordova.system.library.7=com.google.android.gms:play-services-location:9.8.0
cordova.system.library.8=com.android.support:support-core-utils:24.1.0
cordova.system.library.9=com.android.support:support-v4:26.+
cordova.gradle.include.6=cordova-plugin-local-notification/app-localnotification.gradle
cordova.gradle.include.7=cordova-plugin-mauron85-background-geolocation/app-logtofile.gradle
cordova.system.library.10=com.google.android.gms:play-services-location:9.8.0
cordova.system.library.11=com.android.support:support-v4:+
cordova.system.library.12=com.google.android.gms:play-services-location:9.8.0
cordova.system.library.13=com.android.support:support-v4:26.+
cordova.system.library.14=com.android.support:appcompat-v7:26.+

build.gradle


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

    // Switch the Android Gradle plugin version requirement depending on the
    // installed version of Gradle. This dependency is documented at
    // http://tools.android.com/tech-docs/new-build-system/version-compatibility
    // and https://issues.apache.org/jira/browse/CB-8143
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
    }
}

...

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    // SUB-PROJECT DEPENDENCIES START
    debugCompile(project(path: "CordovaLib", configuration: "debug"))
    releaseCompile(project(path: "CordovaLib", configuration: "release"))
    compile "com.android.support:support-v4:24.1.1+"
    compile "com.google.firebase:firebase-core:9.8.0"
    compile "com.google.firebase:firebase-messaging:9.8.0"
    compile "com.google.android.gms:play-services-location:9.8.0"
    compile "com.google.android.gms:play-services-analytics:9.8.0"
    compile "com.google.android.gms:play-services-maps:9.8.0"
    compile "com.android.support:support-core-utils:24.1.0"
    compile "com.android.support:support-v4:26.+"
    compile "com.android.support:support-v4:+"
    compile "com.android.support:appcompat-v7:26.+"
    // SUB-PROJECT DEPENDENCIES END
}

...

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

I don't know what to do anymore. Tried thousands of solutions and nothing happened.

laxusgooee commented 6 years ago

@usama-ayub

Step 3 (for Cordova-googlemap) framework src="com.google.android.gms:play-services-maps:9.0.0" framework src="com.google.android.gms:play-services-location:9.0.0"

Should be

Step 3 (for Cordova-googlemap) framework src="com.google.android.gms:play-services-maps:9.8.0" framework src="com.google.android.gms:play-services-location:9.8.0"