【问题标题】:Android Phonegap Error: google is not definedAndroid Phonegap 错误:未定义 google
【发布时间】:2014-04-15 06:05:46
【问题描述】:

我有一个适用于 iOS 和 Android 的 PhoneGap 应用程序,它可以查找本地 ATM。我的 Android 版本运行良好,直到本周 Google 似乎改变了 PhoneGap 项目需要构建的一些方式。

我现在收到一条错误消息: 03-11 09:30:03.698: E/Web Console(8768): Uncaught ReferenceError: google is not defined at file:///android_asset/www/js/map.js:36

当我在桌面浏览器上运行此文件时,一切正常。由于某种原因,这不再适用于手机。

我曾尝试对 Google API 使用多个不同的调用,包括:

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key={API_KEY}&sensor=false"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?&sensor=false"></script>

这些上周在 Android 上运行良好。这些仍然适用于 iOS 和我的桌面浏览器。

错误指向的具体代码行是:

geocoder = new google.maps.Geocoder();

这是我第一次调用 Google API。

任何帮助将不胜感激。

【问题讨论】:

  • 您的脚本标签似乎不起作用。您是否将地图域包含在白名单中?
  • 谢谢!我不知道发生了什么,但我一定是不小心删除了那条线!如果你想回答我可以标记它是正确的。
  • 不客气。当然我会这样做 - 我最短的答案;)谢谢。

标签: android google-maps google-maps-api-3 cordova


【解决方案1】:

确保将 Google 地图域包含在白名单中;)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-09-12
    • 1970-01-01
    • 2013-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-17
    • 1970-01-01
    相关资源
    最近更新 更多