简体   繁体   English

错误-Google Maps Cordova插件安装

[英]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! cordova插件添加https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_ANDROID = androidkey --variable API_KEY_FOR_IOS = ioskey --save✖运行命令-失败! [ERROR] Cordova encountered an error. [错误] Cordova遇到错误。 You may get more insight by running the Cordova command above directly. 通过直接运行上面的Cordova命令,您可能会获得更多的见解。 [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. [错误]运行cordova插件添加https://github.com/mapsplugin/cordova-plugin-googlemaps#multi ...(退出代码1)时发生错误:错误:无法获取插件https://github.com通过注册表/ mapsplugin / cordova-plugin-googlemaps#multiple_maps Probably this is either a connection problem, or plugin spec is incorrect. 可能是连接问题,或者插件规格不正确。 Check your connection and plugin name/version/URL. 检查您的连接和插件名称/版本/ 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 谢谢

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 在您的编辑器(我使用VS Code)中,搜索文本cordova-plugin-googlemaps所有实例:我在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 另外,删除文件package-lock.json可以
  4. Remove all platforms ( android or ios ) from your project 从项目中删除所有平台( androidios
  5. Delete the following folders from your project: platforms,plugins,www 从您的项目中删除以下文件夹: platforms,plugins,www
  6. Add the cordova-plugin-googlemaps (At this point, it should successfully save it in config.xml ) 添加cordova-plugin-googlemaps (此时,它应该成功将其保存在config.xml
  7. Add your platforms 添加平台
  8. Then run your application 然后运行您的应用程序

Please try 请试试

cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID=androidkey --variable API_KEY_FOR_IOS=ioskey --save cordova插件添加cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID = androidkey --variable API_KEY_FOR_IOS = ioskey --save

Could you show me the result of this command ( with --verbose option )? 您能告诉我该命令的结果( 带有--verbose选项 )吗?

$>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. 如果使用Android Studio 3.0预览打开项目,则gradlew可能会遇到此错误。

solution 1: 解决方案1:

$> chmod +x platforms/android/gradlew

solution 2: 解决方案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) 解决方案3:使用Android Studio打开项目,并将gradle版本修复为3.5(或3.3)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PhoneGap Cordova插件Google Maps-插件未定义 - PhoneGap Cordova plugin google maps - Plugin not defined Ionic / Cordova Google Maps插件问题 - Issue with Ionic/Cordova Google Maps Plugin 在Android模拟器中使用Cordova Google Maps插件时出错:GoogleMaps插件中未定义getMap - Error using Cordova Google Maps plugin in android emulator: getMap is not defined in GoogleMaps plugin 无法安装'plugin.google.maps':错误:缺少变量:cordova中的API_KEY_FOR_ANDROID - Failed to install 'plugin.google.maps':Error: Variable(s) missing: API_KEY_FOR_ANDROID in cordova 科尔多瓦3.3 Android和Google地图,出现Chromium错误 - Cordova 3.3 Android and Google maps, Chromium error 当我尝试使用以下科尔多瓦google maps插件https://github.com/mapsplugin/cordova-plugin-googlemaps时出现错误 - I am getting an error when I tried to use the following cordova google maps plugin https://github.com/mapsplugin/cordova-plugin-googlemaps 科尔多瓦和谷歌地图 - Cordova and google maps 地图拖动事件谷歌地图android sdk cordova cordova-plugin-googlemaps - map drag event google maps android sdk cordova cordova-plugin-googlemaps Google Maps Utility安装 - Google Maps Utility installation 科尔多瓦安装错误 - Cordova installation error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM