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

Created on 1 Feb 2018  ·  24Comments  ·  Source: mapsplugin/cordova-plugin-googlemaps

I'm submitting a ... (check one with "x")

  • [ ] question
  • [x] any problem or bug report
  • [ ] feature request

If you choose 'problem or bug report', please select OS: (check one with "x")

  • [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 [email protected]
> 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.
pending / waiting

Most helpful comment

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.

All 24 comments

You need to use the google play services sdk 11.8.0

Thanks.
If I run sdkmanager --list I get:

> extras;google;google_play_services | 46 | Google Play services | extras\google\google_play_services\

Is this what I have to check? Or I have to modify the build.gradle file?

Please show me the build.gradle file

The build.gradle file should be like this:

dependencies {
    implementation fileTree(dir: 'libs', include: '*.jar')
    // SUB-PROJECT DEPENDENCIES START
    implementation(project(path: "CordovaLib"))
    compile "com.google.android.gms:play-services-maps:11.8.+"
    compile "com.google.android.gms:play-services-location:11.8.+"
    // SUB-PROJECT DEPENDENCIES END
}

and the project.properties file should be like this:

target=android-26
android.library.reference.1=CordovaLib
cordova.system.library.1=com.google.android.gms:play-services-maps:11.8.+
cordova.system.library.2=com.google.android.gms:play-services-location:11.8.+

Please confirm both files.

Same problem here, my build.gradle and project.properties look exactly like that. What can I do?

Please share your project files on github. I will check it.

When I had the same problem it turned out that onesignal plugin is using a custom way of enforcing play services in build.gradle file and it forces version 11.2 in this file:

https://github.com/OneSignal/OneSignal-Cordova-SDK/blob/master/build-extras-onesignal.gradle

Your case might be different just wanted to share my finding.

ping

I encountered the same problem, and like @battika, I use OneSignal. Downgrading cordova-plugin-googlemaps to 2.1.1 solves the problem. Sadly I cannot share my project files, but I'll see if I can create a minimal project that reproduces the issue.

I will come back to you tomorrow.

I have the same issue when using the google maps plugin version 2.2.2 and OneSignal, I have follow the advice of @Gachapen and now is working

I have added in this way

cordova plugin add [email protected] --variable API_KEY_FOR_ANDROID="__yourkey___" --variable API_KEY_FOR_IOS="__yourkey___"

The list of plugins that I have is

cordova plugin list
card.io.cordova.mobilesdk 2.1.0 "CardIO"
com.synconset.imagepicker 2.1.8 "ImagePicker"
cordova-android-support-gradle-release 0.0.2 "cordova-android-support-gradle-release"
cordova-custom-config 5.0.2 "cordova-custom-config"
cordova-plugin-background-mode 0.7.2 "BackgroundMode"
cordova-plugin-badge 0.8.7 "Badge"
cordova-plugin-browsertab 0.2.0 "cordova-plugin-browsertab"
cordova-plugin-buildinfo 1.1.0 "BuildInfo"
cordova-plugin-camera 3.0.0 "Camera"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-datepicker 0.9.3 "DatePicker"
cordova-plugin-device 1.1.7 "Device"
cordova-plugin-facebook4 1.9.1 "Facebook Connect"
cordova-plugin-firebase 0.1.24 "Google Firebase Plugin"
cordova-plugin-googlemaps 2.1.1 "cordova-plugin-googlemaps"
cordova-plugin-inappbrowser 1.7.2 "InAppBrowser"
cordova-plugin-ionic-webview 1.1.16 "cordova-plugin-ionic-webview"
cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification"
cordova-plugin-mauron85-background-geolocation 2.3.3 "CDVBackgroundGeolocation"
cordova-plugin-paystack 3.1.0 "PaystackPlugin"
cordova-plugin-splashscreen 4.1.0 "Splashscreen"
cordova-plugin-statusbar 2.4.1 "StatusBar"
cordova-plugin-stripe 1.5.3 "cordova-plugin-stripe"
cordova-plugin-vibration 2.1.6 "Vibration"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova.plugins.diagnostic 3.9.2 "Diagnostic"
onesignal-cordova-plugin 2.2.5 "OneSignal Push Notifications"

@itzamnamx I don't mind if you downgrade the maps plugin version, but new version has been fixed lots of bugs.

Try [email protected]

Hi Masashi,

I will try right now and let you know asap.

Thank you!

⁣Enviado desde TypeApp ​

En feb. 6, 2018 8:12 PM, en 8:12 PM, Masashi Katsumata notifications@github.com escribió:

@itzamnamx I don't mind if you downgrade the maps plugin version,
but new version has been fixed lots of bugs.

Try [email protected]

--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/2040#issuecomment-363632740

@obbe79 ping

I can confirm the bug in a blank ionic project with only OneSignal and GoogleMaps plugins installed.

cli packages: (C:\Users\Fabs\AppData\Roaming\npm\node_modules)

@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  : android 7.0.0
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 25.2.5
Node              : v8.9.3
npm               : 5.6.0
OS                : Windows 10

cordova plugins
cordova-plugin-device 2.0.1 "Device"
cordova-plugin-googlemaps 2.2.3 "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"
onesignal-cordova-plugin 2.2.5 "OneSignal Push Notifications"

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.

Thank you for your help, @battika

Anytime 👍

@battika Ty, worked like a charm

So my build.gradle file for some reason has this:

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:11.0.+"
    compile "com.google.android.gms:play-services-location:11.0.+"
    // SUB-PROJECT DEPENDENCIES END
}

I will try to change that to 11.8.+ and see if it compiles.

I have the same problem. I'm also using Onesignal with latest version of googlemaps plugin.

good work @battika

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

@wf9a5m75 tried change version but nothing worked for me i got same error again?

Was this page helpful?
0 / 5 - 0 ratings