Cordova谷歌地图出现在较低版本的Android手机4.1.2中,但不出现在最新版本的棒棒糖中为什么?

Cordova谷歌地图出现在较低版本的Android手机4.1.2中,但不出现在最新版本的棒棒糖中为什么?,android,cordova,google-maps,Android,Cordova,Google Maps,该应用程序在低版本Android手机上运行良好(在jellybean上测试)。它在低版本(4.1.2)Android手机上显示谷歌地图 我调用GoogleMapAPI的脚本是 <script src="https://maps.googleapis.com/maps/api/js?key=xxxxx"> </script> HTML元标记 <meta http-equiv="Content-Security-Policy" content="default-src

该应用程序在低版本Android手机上运行良好(在jellybean上测试)。它在低版本(4.1.2)Android手机上显示谷歌地图

我调用GoogleMapAPI的脚本是

<script src="https://maps.googleapis.com/maps/api/js?key=xxxxx"> </script>
HTML元标记

<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *"> 
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">


那么为什么它不能在最新的安卓手机(5.1.1)上运行呢?它显示的是空白的div?

,所以下面的这些更改对我的地图起到了作用

1将地图脚本链接更改为下面的路径(地图API v=3)


(如果您想在我的案例中嵌入其他库示例:('places'))


注意:(脚本链接之后) jquery.min.js和index.js然后 放置此地图脚本链接)

2有时您可能会遇到以下错误

[拒绝加载脚本'maps.googleapis.com/maps/api/…;因为它违反了以下内容安全策略指令:“default src'self'data:gap:ssl.gstatic.com'safe eval'”。请注意,未显式设置'script src',因此将'default src'用作回退。]

为此更改meta http equiv=“内容安全策略”




其余的都一样。谢谢。

你能试试没有api密钥的googlemap api v3并检查它是否工作。它不适用于这个Google map api URL,而且我在最新版本中遇到了“Google未定义”错误。有一件事要用http代替https。。。如果不起作用,那么请检查此项
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <application android:hardwareAccelerated="true" android:icon="@drawable/logo" android:label="@string/app_name" android:supportsRtl="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="22" />
 map = new google.maps.Map(document.getElementById("mapmake"), myOptions);
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *"> 
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<script type='text/javascript' src='https://maps-api-ssl.google.com/maps/api/js?v=3.3&sensor=false'></script>
<script type='text/javascript' src='https://maps-api-ssl.google.com/maps/api/js?v=3.3&sensor=false&libraries=places'></script>
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' http://* 'unsafe-inline'; script-src 'self' https://* 'unsafe-inline' 'unsafe-eval'" />