cordova-plugin-googlemaps: Build error: cannot find symbol

I’m submitting a … (check one with “x”)

  • question
  • any problem or bug report
  • feature request

If you choose ‘problem or bug report’, please select OS: (check one with “x”)

  • Android
  • iOS

cordova information: (run $> cordova plugin list)

cordova-plugin-device 2.0.1 "Device"
cordova-plugin-googlemaps 2.2.2 "cordova-plugin-googlemaps"
cordova-plugin-ionic-keyboard 2.0.5 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 1.1.16 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-whitelist 1.3.3 "Whitelist"

If you use @ionic-native/google-maps, please tell the package.json (only @ionic-native/core and @ionic-native/google-maps are fine mostly)

    @ionic-native/core": "4.4.0",
    @ionic-native/google-maps": "^4.5.3",

My Ionic Info

cli packages: 

    @ionic/cli-utils        : 1.19.1
    ionic (Ionic CLI)       : 3.19.1

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : 6.2.3
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v9.4.0
    npm               : 5.6.0
    OS                : Windows 7

Current behavior: Blank IONIC app won’t ionic cordova run android with cordova-plugin-googlemaps. It runs smoothly without the cordova-plugin-googlemaps.

Steps:

> ionic start geoTest blank > cd geoTest > ionic cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="mykey" > npm install --save @ionic-native/google-maps > ionic cordova platform add android@6.2.3 > ionic cordova run android

Expected behavior: Build

Related code, data or error log (please format your code or data):

BUILD FAILED

Total time: 13.016 secs
(node:7056) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
C:\Users\user\Documents\GitHub\ionic_proj\geoTest\platforms\android\src\plugin\google\maps\PluginMap.java:84: error:
cannot find symbol
    GoogleMap.OnInfoWindowLongClickListener, GoogleMap.OnInfoWindowCloseListener, GoogleMap.OnMyLocationClickListener, G
oogleMap.OnPoiClickListener {
                                                                                           ^
  symbol:   class OnMyLocationClickListener
  location: class GoogleMap
C:\Users\user\Documents\GitHub\ionic_proj\geoTest\platforms\android\src\plugin\google\maps\PluginMap.java:335: error:
 cannot find symbol
              map.setOnMyLocationClickListener(PluginMap.this);
                 ^
  symbol:   method setOnMyLocationClickListener(PluginMap)
  location: variable map of type GoogleMap
C:\Users\user\Documents\GitHub\ionic_proj\geoTest\platforms\android\src\plugin\google\maps\PluginMap.java:763: error:
 cannot find symbol
                  map.setOnMyLocationClickListener(null);
                     ^
  symbol:   method setOnMyLocationClickListener(<null>)
  location: variable map of type GoogleMap
C:\Users\user\Documents\GitHub\ionic_proj\geoTest\platforms\android\src\plugin\google\maps\PluginMap.java:2490: error
: method does not override or implement a method from a supertype
  @Override
  ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
4 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 24 (11 by maintainers)

Most upvoted comments

Guys, as a workaround all you need to do is clone the OneSignal-Cordova-SDK plugin and in the build-extras-onesignal.gradle file change the com.google.android.gms and com.google.firebase dependencies like this:

def versionGroupAligns = [
    // ### Google Play Services library
    'com.google.android.gms': [
        'version': '11.8.+'
    ],

    // ### Google Firebase library
    // Although not used by OneSignal Firebase has some dependencies on gms
    // If present, ensuring they are aligned
    'com.google.firebase': [
        'version': '11.8.+'
    ],
...

Then, reinstall the OneSignal plugin from your filesystem.

I know it is not ideal but works for me. Hope OneSignal will use the latest Play Services version in their next release. I created an issue in their repo: https://github.com/OneSignal/OneSignal-Cordova-SDK/issues/297

I did not have time to dig deeper how this issue can be resolved in a more elegant way but if you do I’ll be more than happy if you let me know.

i am facing the same issue, i tried changing to 11.8.0 but it doesnt help. any work around?

@battika Ty, worked like a charm

You need to use the google play services sdk 11.8.0