Cordova-plugin-googlemaps: installation freezes whiling adding to iOS platform

Created on 12 Apr 2020  路  17Comments  路  Source: mapsplugin/cordova-plugin-googlemaps

Screen Shot 2020-04-12 at 8 19 31 PM
I'm submitting a ... (check one with "x")

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

OS: (check one with "x")

  • [ ] Android
  • [x] iOS
  • [ ] Browser

cordova information: (run $> cordova plugin list)

branch-cordova-sdk 4.1.2 "branch-cordova-sdk"
com-sarriaroman-photoviewer 1.1.18 "PhotoViewer"
cordova-plugin-android-permissions 1.0.2 "Permissions"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-background-mode 0.7.3 "BackgroundMode"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-device 1.1.7 "Device"
cordova-plugin-facebook4 6.4.0 "Facebook Connect"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-googlemaps 2.7.1 "cordova-plugin-googlemaps"
cordova-plugin-inappbrowser 3.2.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.1.3 "cordova-plugin-ionic-webview"
cordova-plugin-market 1.2.0 "Market"
cordova-plugin-network-information 1.3.4 "Network Information"
cordova-plugin-sms-retriever-manager 0.0.1 "Device"
cordova-plugin-splashscreen 4.1.0 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova.plugins.diagnostic 5.0.1 "Diagnostic"
ionic-plugin-deeplinks 1.0.20 "Ionic Deeplink Plugin"
onesignal-cordova-plugin 2.8.4 "OneSignal Push Notifications"

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 : 
@ionic-native/google-maps : 

Current behavior:

When I add cordova-plugin-googlemaps to my project that have Android & iOS platform, it installs normally to android but it freezes for ios when reaching Installing "cordova-plugin-googlemaps" for ios.

If I use --verbose, I found that it stops while installing the SDK from github by running the following command:
npm install https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk --production --save-exact

It's the first time I face such issue with cordova-plugin-googlemaps.

Most helpful comment

Technically the installation is not freezing, the git checkout is stuck on git index-pack subcommand for long time.

Because the dependency is a git URL (https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk) the npm install command does a full git clone of the repository - which includes binary files for every version published in the repository. Also because it is a git dependency, there is no caching of the repository in .npm cache, so it checks out the whole repository on every clean build.

The binary files are big (tens of MB) and because of that git clone must transfer lot of data, right now it is a 558.53 MiB repository (or to be more specific, the file in .git/objects/pack).

Ideally every version of SDK should be published on NPM, thus dropping the install size down to the actual size of the framework file (currently around 45MB), but i am not sure how long is that acceptable (in NPM discussion from 2016, they disliked packages bigger than 20MB, but said that up to 120MB is possible ).

Alternatively cordova-plugin-googlemaps-sdk could use GIT LFS (thus cutting out the binary files from actual GIT repository checkout, as git would only check out the repository without the binary files, then grab the binary files corresponding to the checked out branch) or as a final alternative, use a hook to grab the binary files instead of hosting them in the repository.

All 17 comments

Please ask to the developer of "cordova-plugin-geolocation". I don't know other plugin details

Please ask to the developer of "cordova-plugin-geolocation". I don't know other plugin details

Sorry i meant cordova-plugin-googlemaps not geolocation.

I will update the issue description

Okay, please add the whole verbose log.

I tried to reinstall it today and it works as expected without any issue.

I'm having the same issue. Installation freezes at Running command: npm install https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk --production --save

Here is the full log:

$ cordova plugin add cordova-plugin-googlemaps --verbose
No scripts found for hook "before_plugin_add".
No version specified for cordova-plugin-googlemaps, retrieving version from package.json
Calling plugman.fetch on plugin "cordova-plugin-googlemaps@^2.7.1"
Calling plugman.install on plugin "/Users/mark/workspace/wierde-app/plugins/cordova-plugin-googlemaps" for platform "ios
Installing "cordova-plugin-googlemaps" for ios
Running command: /Users/mark/workspace/wierde-app/platforms/ios/cordova/version 
Command finished with error code 0: /Users/mark/workspace/wierde-app/platforms/ios/cordova/version 
Running command: /Users/mark/workspace/wierde-app/platforms/ios/cordova/version 
Running command: /Users/mark/workspace/wierde-app/platforms/ios/cordova/apple_xcode_version 
Running command: /Users/mark/workspace/wierde-app/platforms/ios/cordova/apple_ios_version 
Command finished with error code 0: /Users/mark/workspace/wierde-app/platforms/ios/cordova/version 
Command finished with error code 0: /Users/mark/workspace/wierde-app/platforms/ios/cordova/apple_xcode_version 
Command finished with error code 0: /Users/mark/workspace/wierde-app/platforms/ios/cordova/apple_ios_version 
Dependencies detected, iterating through them...
Requesting plugin "com.googlemaps.ios".
Plugin dependency "com.googlemaps.ios" not fetched, retrieving then installing.
fetch: Installing https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk to /Users/mark/workspace/wierde-app
Running command: npm install https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk --production --save

Technically the installation is not freezing, the git checkout is stuck on git index-pack subcommand for long time.

Because the dependency is a git URL (https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk) the npm install command does a full git clone of the repository - which includes binary files for every version published in the repository. Also because it is a git dependency, there is no caching of the repository in .npm cache, so it checks out the whole repository on every clean build.

The binary files are big (tens of MB) and because of that git clone must transfer lot of data, right now it is a 558.53 MiB repository (or to be more specific, the file in .git/objects/pack).

Ideally every version of SDK should be published on NPM, thus dropping the install size down to the actual size of the framework file (currently around 45MB), but i am not sure how long is that acceptable (in NPM discussion from 2016, they disliked packages bigger than 20MB, but said that up to 120MB is possible ).

Alternatively cordova-plugin-googlemaps-sdk could use GIT LFS (thus cutting out the binary files from actual GIT repository checkout, as git would only check out the repository without the binary files, then grab the binary files corresponding to the checked out branch) or as a final alternative, use a hook to grab the binary files instead of hosting them in the repository.

NPM doesn't accept large files anymore.
And could you pay Git-LFS fee? I think no body pay for the fee.

Cordova supports CocoaPod, but many beginners fail to use CocoaPod. That's why this plugin goes back this style.

I think I did as far as I can do, except improving Cordova itself.

use a hook to grab the binary files instead of hosting them in the repository.

This way is not acceptable. Because Cordova hook does not work on cloud build environment, such as phone gap build.

GitLFS free bandwidth capacity is only 1GB/year.
If you cover all amount of the fee, I can do GitLFS.

There is no one such a big sponsor, so far.

Screenshot_20200724-071053

Also, Cordova supports zip (or tar) file installation (I don't know still support it).
This plugin did at once, then many people reported problems soon.


I'm looking for good idea, but I have no more ideas.

Tarball install is probably broken: https://github.com/apache/cordova-cli/issues/452

Unfortunately i do not have any other ideas either. For my use case, i solved the slow checkout by automatically changing the plugin.xml back to the CocoaPod way. I do that by preinstalling cordova-plugin-googlemaps at npm install phase of my project (as devDependency), then i automatically patch plugin.xml of cordova-plugin-googlemaps in node_modules before i do any cordova commands. But that is not an universal solution for everyone.

Hi @faugusztin

Can you please provide of how did you solve from stucking at installation?

Thanks.

As i said, installation is technically not stuck. If you check the process list (for example with htop), you could see that npm install command is doing (if i remember correctly) git-index-pack commands for long, long time.

My way was to revert the changes in plugin.xml back to CocoaPod way at build time. Because Cordova uses version installed to node_modules if there is one, i do the following before doing a cordova platform add/prepare:

  1. put the required version of cordova-plugin-googlemaps to package.json's devDependencies section, so for current version add:
    "cordova-plugin-googlemaps": "2.7.1"
  2. perform npm install
  3. modify node_modules/cordova-plugin-googlemaps/plugin.xml. Replace:
    <dependency id="com.googlemaps.ios" url="https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk" />
    with following:
    <podspec>
      <config>
      </config>
      <pods>
        <pod name="GoogleMaps" spec="~> 3.9.0"/>
      </pods>
    </podspec>
  1. perform the rest of the steps of building a Cordova app (add platform, prepare etc).

plugin.xml can be modified either by a script changing the file automatically, or just by copying over a modified version of the plugin.xml over the official one.

Thank you for this @faugusztin and sorry, I'm truly new to Mobile Dev't so I don't know what does or how Pods works.

I'll let you know after performing your steps.

git clone [email protected]:mapsplugin/cordova-plugin-googlemaps-sdk.git

cd (path to)/project dir/

cordova plugin install (path to)/cordova-plugin-googlemaps-sdk

cordova plugin install cordova-plugin-googlemaps

Thank you so much @wf9a5m75

Was this page helpful?
0 / 5 - 0 ratings