[英]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: 我在离子项目中通过一些大胆的步骤解决了这个问题,如下所示:
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
找到了它们 package-lock.json
for good measure 另外,删除文件package-lock.json
可以 android
or ios
) from your project 从项目中删除所有平台( android
或ios
) platforms,plugins,www
从您的项目中删除以下文件夹: platforms,plugins,www
cordova-plugin-googlemaps
(At this point, it should successfully save it in config.xml
) 添加cordova-plugin-googlemaps
(此时,它应该成功将其保存在config.xml
) 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.