2017-07-17 178 views
1

我得到這個錯誤在終端 -錯誤 - 谷歌地圖科爾多瓦插件安裝

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

這不是我的連接。我已經嘗試過在另一個應用程序中,它似乎工作正常。由於

回答

1

我在我的離子項目中解決了這個問題,採取了一些大膽的步驟,如下所示:

  1. 在您的編輯器中(我使用VS代碼),搜索文本的所有實例cordova-plugin-googlemaps:我在config.xml,package.json & package-lock.json中發現它們
  2. 從這些文件中刪除所有這些實例。
  3. 此外,刪除文件package-lock.json好措施
  4. 從項目中刪除所有的平臺(androidios
  5. 從項目中刪除下列文件夾:platforms,plugins,www
  6. 添加cordova-plugin-googlemaps(在這一點上,要成功地將其保存在​​3210)
  7. 添加您的平臺
  8. 然後運行你的應用程序
0

請嘗試

科爾多瓦插件添加科爾多瓦 - 插件 - 谷歌地圖--variable API_KEY_FOR_ANDROID = androidkey --variable API_KEY_FOR_IOS = ioskey --save

0

你能告訴我這個命令的結果(與 - 跳動選項)?

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

如果您使用Android Studio 3.0 Preview打開該項目,則可能會通過gradlew面對此錯誤。

溶液1:

$> chmod +x platforms/android/gradlew 

溶液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 

溶液3: 打開與Android工作室該項目,並固定gradle這個版本至3.5(或3.3)