userlkjsflkdsvm
userlkjsflkdsvm

Reputation: 973

Error - Google Maps Cordova Plugin installation

I am getting this error in the terminal --

cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_ANDROID=androidkey --variable API_KEY_FOR_IOS=ioskey --save ✖ Running command - failed! [ERROR] Cordova encountered an error. You may get more insight by running the Cordova command above directly. [ERROR] An error occurred while running cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multi... (exit code 1): Error: Failed to fetch plugin https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps via registry. Probably this is either a connection problem, or plugin spec is incorrect. Check your connection and plugin name/version/URL. Failed to get absolute path to installed module

It's not my connection. I have tried this in another app and it seems to work fine. Thanks

Upvotes: 2

Views: 2602

Answers (3)

Richie254
Richie254

Reputation: 494

I resolved this in my ionic project with some bold steps as follows:

  1. In your editor (I use VS Code), search for all instances of the text cordova-plugin-googlemaps: I found them in config.xml,package.json & package-lock.json
  2. Delete all these instances from those files.
  3. Also, delete the file package-lock.json for good measure
  4. Remove all platforms (android or ios) from your project
  5. Delete the following folders from your project: platforms,plugins,www
  6. Add the cordova-plugin-googlemaps (At this point, it should successfully save it in config.xml)
  7. Add your platforms
  8. Then run your application

Upvotes: 2

wf9a5m75
wf9a5m75

Reputation: 6158

Could you show me the result of this command (with --verbose option)?

$>cordova plugin add http://https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_ANDROID=... --variable API_KEY_FOR_IOS=... --verbose

If you open the project with Android Studio 3.0 Preview, you may face this error by gradlew.

solution 1:

$> chmod +x platforms/android/gradlew

solution 2:

$> cordova plugin rm cordova-plugin-googlemaps
$> cordova platform rm android
$> cordova plugin add http://https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_ANDROID=... --variable API_KEY_FOR_IOS=...
$> cordova platform add android

solution 3: Open the project with Android Studio, and fix the gradle version to 3.5 (or 3.3)

Upvotes: 0

sanme98
sanme98

Reputation: 572

Please try

cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID=androidkey --variable API_KEY_FOR_IOS=ioskey --save

Upvotes: 1

Related Questions