mapsplugin / cordova-plugin-googlemaps

Google Maps plugin for Cordova
Apache License 2.0
1.66k stars 913 forks source link

Cordova 9 support #2581

Closed nerumo closed 5 years ago

nerumo commented 5 years ago

I'm submitting a ...

OS: (check one with "x")

The comming cordova 9 version will drop the support for requireCordovaModule calls in the hooks.

Example error message with the latest nightlies from cordova:

Failed to install 'cordova-plugin-googlemaps': CordovaError: Using "requireCordovaModule" to load non-cordova module "fs" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
wf9a5m75 commented 5 years ago

I see. I will test it later. Thank you for letting me know.

wf9a5m75 commented 5 years ago

Please try to install from the multiple_maps branch.

hartherbert commented 5 years ago

I had to downgrade to cordova@8.1.2 to make it work on my system. Support for cordova 9 is pretty important.

wf9a5m75 commented 5 years ago

As I said above, please use the multiple_maps branch.

nerumo commented 5 years ago

I can confirm, the multiple_maps branch works. I'm actually not using the multiple_branchs branch, I use the published npm package. Is there a plan to make a npm release of this branch? Are there breaking changes?

nerumo commented 5 years ago

Ah sorry, too early: ios install still failes because of check_sdk_version.js

wf9a5m75 commented 5 years ago

Please report with error log, not just Ah sorry, too early: ios install still failes because of check_sdk_version.js.

nerumo commented 5 years ago

Sorry, I don't have the call stack right now, but I can point you to the error. In https://github.com/mapsplugin/cordova-plugin-googlemaps/blob/multiple_maps/src/ios/check_sdk_version.js

On line 3, 5 and 6 there are usages of the removed requireCordovaModule method.

bugsmafia commented 5 years ago

Give instructions on how to install the plugin on Cordova 9.0 and Android 8.0

PS C:\Project\app> cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_ANDROID="*****" --variable API_KEY_FOR_IOS="*****" Using "requireCordovaModule" to load non-cordova module "fs" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.

npm --v 6.9.0 node -v v9.8.0

Ionys320 commented 5 years ago

Hello, I have the same problem and use the multiple_maps doesn't work. What can I do ?

wf9a5m75 commented 5 years ago

PR is merged to the multiple_maps branch.

mariusbolik commented 5 years ago

What's with line 3? In the PR there is still the requireCordovaModule() present! Shouldn't this be replaced, too?

wf9a5m75 commented 5 years ago

No. requireCordovaModule("q") is only deprecated. Please try by yourself before asking.

nerumo commented 5 years ago

IMHO @mariusbolik is right, that it should be replaced. but @wf9a5m75 is right too and the last PR solved the issue. Thank you.

Since working with git references is slowing the restore process quite a bit: is there a plan to make a npm release too?

daninietoandres commented 5 years ago

Hey i have the same problem with ionic cordova plugin add cordova-plugin-geolocation

hartherbert commented 5 years ago

@mariusbolik on line 3 the command requireCordovaModule('cordova-common') is valid. the requireCordovaModule is only deprecated for loading non-cordova modules.

@daninietoandres just use the master-branch of the cordova-plugin-geolocation via npm i https://github.com/apache/cordova-plugin-geolocation.git

mariusbolik commented 5 years ago

I don't really know if Google Maps is the issue, but with --livereload (Ionic) I get the following error:

FGButterLettuce commented 5 years ago
>cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID=... --variable API_KEY_FOR_IOS=... --save
Installing "cordova-plugin-googlemaps" for android
Failed to install 'cordova-plugin-googlemaps': CordovaError: Using "requireCordovaModule" to load non-cordova module "fs" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
    at Context.requireCordovaModule (/home/linuxbrew/.linuxbrew/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/Context.js:57:15)
    at module.exports (/home/niranjan/APM App/Master/APMApplication/plugins/cordova-plugin-googlemaps/src/before_plugin_install.js:3:16)
    at runScriptViaModuleLoader (/home/linuxbrew/.linuxbrew/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:181:32)
    at runScript (/home/linuxbrew/.linuxbrew/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:16)
    at /home/linuxbrew/.linuxbrew/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:125:20
    at processTicksAndRejections (internal/process/next_tick.js:81:5)
Using "requireCordovaModule" to load non-cordova module "fs" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
[ERROR] An error occurred while running subprocess cordova.

On attempting to use the multiple_maps branch, i get the same result

$ ionic cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_ANDROID="..." --variable API_KEY_FOR_IOS="..."

> cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_ANDROID=... --variable API_KEY_FOR_IOS=... --save
Using "requireCordovaModule" to load non-cordova module "fs" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
[ERROR] An error occurred while running subprocess cordova.

im running cordova 9.0.0, ionic 4.12.0 & npm 6.9.0

mariusbolik commented 5 years ago

I don't really know if Google Maps is the issue, but with --livereload (Ionic) I get the following error:

I'm still getting this error using the plugin with ionic cordova run ios --livereload Without --livereload it's working. If I uninstall this plugin --livereload is working again.

@adamduren @wf9a5m75

adamduren commented 5 years ago

@mariusbolik I think this is unrelated to this issue / plugin. Try uninstalling cordova-plugin-googlemaps and remove references to the plugin. Try to rebuild and see if the problem still exists. If it does then I would suggest to create a separate issue for this repo.

adamduren commented 5 years ago

@mariusbolik I actually just came across this issue when upgrading @ionic/build-angular to 1.5.0 try reverting to or installing 1.4.1. Hope this helps.

https://github.com/ionic-team/angular-toolkit/issues/109

wf9a5m75 commented 5 years ago

@mariusbolik Please try the @adamduren's advice. If it does not work, please share your project files on Github repository. I will check it.

mariusbolik commented 5 years ago

@adamduren WOW! Thank you. This really was the solution! Everything works fine now.

FGButterLettuce commented 5 years ago

Update on the issue, simply downgrading to Cordova 8.1.0 worked for me as well, I believe downgrading angular would also do the trick

thineikhaing commented 5 years ago

I'm getting the issue Screen Shot 2019-04-10 at 5 12 03 PM

"CordovaError: Using "requireCordovaModule" to load non-cordova module "fs" is not supported. Instead, add this module to your dependencies and use regular "require" to load it. " in running cordova 9.0.0, android 8.0.0, and ios 5.0.0

adamduren commented 5 years ago

@thineikhaing we're still waiting on @wf9a5m75 to release a new version I believe

sudhirbitsgoa commented 5 years ago

'cordova-plugin-googlemaps': CordovaError: Using "requireCordovaModule" to load non-cordova module'cordova-plugin-googlemaps': CordovaError: Using "requireCordovaModule" to load non-cordova module same here

wf9a5m75 commented 5 years ago

Use the multiple_maps branch

adamduren commented 5 years ago

@wf9a5m75 when you create new releases are they from master or multiple_maps?

luisgagocasas commented 5 years ago

I solved it by changing the version of Cordova.

npm uninstall -g cordova npm cache clean --force npm i -g cordova@8.1.2

Of causality will they have any improvement for cordova 9?

giothc94 commented 5 years ago

Muchas gracias @luisgagocasas Su respuesta soluciono mi problema

wf9a5m75 commented 5 years ago

cordova-plugin-googlemaps v2.6.0 has released.

cloud27 commented 4 years ago

Sorry but I have the problem with the 2.6.2

Ilhamsafeek commented 4 years ago

trying with 'npm i' is worked for me. npm i cordova-plugin-googlemaps@latest

rolinger commented 4 years ago

I am getting this issue for cordova-plugin-enable-multidex (v0.1.3). I just upgraded from cordova 8.0.0 to 9.0.0, added my cordova platform add android (all my plugins were already installed) and got the following error:

Installing "cordova-plugin-enable-multidex" for android Subproject Path: CordovaLib Subproject Path: app Failed to install 'cordova-plugin-enable-multidex': CordovaError: Using "requireCordovaModule" to load non-cordova module "fs" is not supported. Instead, add this module to your dependencies and use egular "require" to load it. at Context.requireCordovaModule (C:\Users\RPO\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\Context.js:57:15) at module.exports (c:\Users\RPO\dev\myApp\plugins\cordova-plugin-enable-multidex\scripts\android\editManifest.js:2:22) at runScriptViaModuleLoader (C:\Users\RPO\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:181:32) at runScript (C:\Users\RPO\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:157:16) at C:\Users\RPO\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:125:20 at process._tickCallback (internal/process/next_tick.js:109:7) Using "requireCordovaModule" to load non-cordova module "fs" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.

Lutherwaves commented 4 years ago

I am also currently experiencing the following issue on IOS when using Cordova 9, when trying to build my app:

Installing "cordova-plugin-googlemaps" for ios
"framework" tag with type "podspec" is deprecated and will be removed. Please use the "podspec" tag.
cordova-plugin-googlemaps depends on GoogleMaps@~> 2.7.0, which conflicts with another plugin. GoogleMaps@~> 3.1.0 is already installed and was not overwritten.
Running command: pod install --verbose
Failed to install 'cordova-plugin-googlemaps': Error: pod: Command failed with exit code 1
    at ChildProcess.whenDone (/Users/ps-wt/Conf-App/conference-app/node_modules/cordova-common/src/superspawn.js:135:23)
    at ChildProcess.emit (events.js:209:13)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
Failed to restore plugin "cordova-plugin-googlemaps" from config.xml. You might need to try adding it again. Error: Error: pod: Command failed with exit code 1

My Ionic Info:

 Ionic:

   Ionic CLI                     : 5.4.0 (/Users/ps-wt/.nvm/versions/node/v12.9.0/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.8.0
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.2.4
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : ios 5.0.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.2, (and 19 other plugins)

Utility:

   cordova-res : 0.6.0 (update available: 0.7.0)
   native-run  : 0.2.8

System:

   ios-deploy : 1.9.4
   ios-sim    : 8.0.2
   NodeJS     : v12.9.0 (/Users/ps-wt/.nvm/versions/node/v12.9.0/bin/node)
   npm        : 6.10.2
   OS         : macOS Mojave
   Xcode      : Xcode 11.0 Build version 11A420a 

My plugins:

com-sarriaroman-photoviewer 1.2.2 "PhotoViewer"
cordova-plugin-add-swift-support 2.0.2 "AddSwiftSupport"
cordova-plugin-advanced-http 2.0.5 "Advanced HTTP plugin"
cordova-plugin-colored-browser-tabs 1.0.0 "cordova-plugin-colored-browser-tabs"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-document-viewer 0.9.10 "SitewaertsDocumentViewer"
cordova-plugin-fcm-with-dependecy-updated 3.2.0 "Cordova FCM Push Plugin"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-opener2 2.2.0 "File Opener2"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-googlemaps 2.6.3-20190930-1257 "cordova-plugin-googlemaps"
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.1.2 "cordova-plugin-ionic-webview"
cordova-plugin-nativestorage 2.3.2 "NativeStorage"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-sqlite-storage 3.1.0 "Cordova sqlite storage plugin - cordova-sqlite-storage plugin version"
cordova-support-google-services 1.3.1 "cordova-support-google-services"
integrator-cordova-plugin-downloader 0.0.1 "Downloader"
ionic-plugin-deeplinks 1.0.20 "Ionic Deeplink Plugin"

However, when I downgrade to Cordova 8.1.2 the application crashes and I get an error alert on the iPhone (on the device, not in Xcode) when launching the app: The Google Maps SDK for iOS crashes, when CFBundleExecutable contains Latin Characters Check CordovaGoogleMaps.m for more information. After entering the maps page once, the whole app crashes and is rendered unusable.

I am using the multiple_maps branch like suggested here and would really appreciate any insights regarding this issue. If needed, I can create a new one. I have also followed the guide on https://ionic.zendesk.com/hc/en-us/articles/360009643533-iOS-Builds-fail-to-install-cordova-plugin-googlemaps-, which does not change anything in my case.

wf9a5m75 commented 4 years ago

First of all, please read this thread, and please please please post formatted text. https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/2661


The Google Maps SDK for iOS crashes, when CFBundleExecutable contains Latin Characters Check CordovaGoogleMaps.m for more information.

Then did you check CordovaGoogleMaps.m?


cordova-plugin-googlemaps depends on GoogleMaps@~> 2.7.0, which conflicts with another plugin. GoogleMaps@~> 3.1.0 is already installed and was not overwritten.

Please search this warning message before posting.

And I think your cocoapod is old or too much latest.

Lutherwaves commented 4 years ago

First of all, please read this thread, and please please please post formatted text.

2661

I am really sorry that I hadn't followed the guidelines and appreciate that you managed to take a look at it anyways!

The Google Maps SDK for iOS crashes, when CFBundleExecutable contains Latin Characters Check CordovaGoogleMaps.m for more information.

Then did you check CordovaGoogleMaps.m?

cordova-plugin-googlemaps depends on GoogleMaps@~> 2.7.0, which conflicts with another plugin. GoogleMaps@~> 3.1.0 is already installed and was not overwritten.

Please search this warning message before posting.

I will check it out as soon as I can and get back to you!

And I think your cocoapod is old or too much latest.

My CocoaPods version:


1.8.1
``
wf9a5m75 commented 4 years ago

For crying out loud, please find the past log.

https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/2612#issuecomment-525681756