导致谷歌的Cordova 5.4.0没有在Android上定义,但没有在iOS上定义(Cordova 5.4.0 causing google is not defined on Android bu

编程入门 行业动态 更新时间:2024-10-27 15:26:18
导致谷歌的Cordova 5.4.0没有在Android上定义,但没有在iOS上定义(Cordova 5.4.0 causing google is not defined on Android but not iOS)

我正在尝试将我现有的应用程序从Cordova 4.x升级到Cordova 5.4。 我在过去更新它没有问题,但这一次,当我尝试启动我的应用程序时,我看到以下错误:

"Uncaught ReferenceError: google is not defined"

我的声明在我的index.html中保持不变,这接近调用我的JS声明。 任何想法?

<script type="text/javascript" src="cordova.js"></script> <script type="text/javascript" src="lib/sencha-touch/sencha-touch-all.js"></script> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3&sensor=false&libraries=geometry"></script>

我验证了我的config.xml和正确的cordova.js被复制到我的Android应用程序的/www目录中(按照之前发布的解决方案),但仍然出现此错误。 同样升级的应用程序在iOS上运行良好,具有所有Google地图功能。

I'm trying to upgrade my existing app from Cordova 4.x to Cordova 5.4. I've had no problem updating it in the past, but this time, I'm seeing the following error when I try to startup my app:

"Uncaught ReferenceError: google is not defined"

My declaration remains unchanged in my index.html and this is near the top of call my JS declarations. Any idea?

<script type="text/javascript" src="cordova.js"></script> <script type="text/javascript" src="lib/sencha-touch/sencha-touch-all.js"></script> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3&sensor=false&libraries=geometry"></script>

I verified that my config.xml and the correct cordova.js is being copied into the /www directory of my Android app (per an earlier posted soln), but still get this error. The same upgraded app works fine on iOS with all the Google Maps functionality.

最满意答案

对于Android的Cordova 4.0.0+,你必须安装cordova-whitelist-plugin并将其添加到你的config.xml:

<access origin="*" /> <!-- Wildcards are allowed for the protocol, as a prefix to the host, or as a suffix to the path --> <allow-intent href="https://*.example.com/*" /> <allow-navigation href="*://*/*" />

It seems with Cordova 4.0.0+ for Android you have to install the cordova-whitelist-plugin and add this to your config.xml:

<access origin="*" /> <!-- Wildcards are allowed for the protocol, as a prefix to the host, or as a suffix to the path --> <allow-intent href="https://*.example.com/*" /> <allow-navigation href="*://*/*" />

更多推荐

js,app,应用,程序,Cordova,电脑培训,计算机培训,IT培训"/> <meta name="descript

本文发布于:2023-07-29 21:05:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1319757.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:定义   Android   Cordova   defined   google

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!