2015-09-04 53 views
0

我有一個phonegap應用程序在Android和Iphone上工作得很好。我已將手機更新到最新版本5.2.2Phonegap 5.2.2 android網絡錯誤

當我想構建我的舊應用程序時,出現了一些錯誤,因此我添加了一個新的平臺android以擁有一個乾淨的項目。

現在,當我在我的手機開始我的申請,我有一個錯誤:

無法加載資源:服務器與404(未找到)http://maps.google.com/maps/api/js?sensor=true

我狀態迴應不明白爲什麼我得到這個,因爲我已經在我的清單上的互聯網許可。我的config.xml中也有access-origin =「*」

如果有人得到了線索。

感謝您的未來答案。

的Manifest.xml:

<?xml version='1.0' encoding='utf-8'?> 
    <manifest android:hardwareAccelerated="true" android:versionCode="10100" android:versionName="1.1.0" android:windowSoftInputMode="adjustPan" package="com.caligeo.xxxxxx" xmlns:android="http://schemas.android.com/apk/res/android"> 
    <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" /> 
    <application android:debuggable="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name"> 
     <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:launchMode="singleTop" android:name=".MainActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity android:name="com.plugin.gcm.PushHandlerActivity" /> 
     <receiver android:name="com.plugin.gcm.CordovaGCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND"> 
      <intent-filter> 
       <action android:name="com.google.android.c2dm.intent.RECEIVE" /> 
       <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> 
       <category android:name="com.caligeo.xxxxxx" /> 
      </intent-filter> 
     </receiver> 
     <service android:name="com.plugin.gcm.GCMIntentService" /> 
    </application> 
    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" /> 
    <uses-feature android:name="android.hardware.telephony" android:required="false" /> 
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
    <uses-permission android:name="android.permission.GET_ACCOUNTS" /> 
    <uses-permission android:name="android.permission.WAKE_LOCK" /> 
    <uses-permission android:name="android.permission.VIBRATE" /> 
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> 
    <permission android:name="com.caligeo.xxxxxx.permission.C2D_MESSAGE" android:protectionLevel="signature" /> 
    <uses-permission android:name="com.caligeo.xxxxxx.permission.C2D_MESSAGE" /> 
    </manifest> 

config.xml文件:

<?xml version='1.0' encoding='utf-8'?> 
<widget id="com.caligeo.xxxxxx" version="1.1.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0"> 
    <name>xxxxxx</name> 
    <description> 
    xxxxxx mobile 
    </description> 
    <author email="[email protected]" href="http://www.yyyyyy.com"> 
    yyyyyy 
    </author> 
    <preference name="phonegap-version" value="3.5.0" /> 
    <preference name="orientation" value="portrait" /> 
    <preference name="permissions" value="none" /> 
    <preference name="DisallowOverscroll" value="true" /> 
    <preference name="webviewbounce" value="false" /> 
    <feature name="http://api.phonegap.com/1.0/geolocation" /> 
    <feature name="http://api.phonegap.com/1.0/network" /> 
    <feature name="http://api.phonegap.com/1.0/notification" /> 
    <preference name="keepRunning" value="true" /> 
    <icon src="icon.png" /> 
    <icon gap:platform="ios" height="57" src="img/icons/ios/logo_appli_57x57.png" width="57" /> 
    <icon gap:platform="ios" height="72" src="img/icons/ios/logo_appli_72x72.png" width="72" /> 
    <icon gap:platform="ios" height="114" src="img/icons/ios/logo_appli_114x114.png" width="114" /> 
    <icon gap:platform="ios" height="76" src="img/icons/ios/logo_appli_76x76.png" width="76" /> 
    <icon gap:platform="ios" height="120" src="img/icons/ios/logo_appli_120x120.png" width="120" /> 
    <icon gap:platform="ios" height="152" src="img/icons/ios/logo_appli_152x152.png" width="152" /> 
    <gap:splash src="splash.png" /> 
    <gap:splash gap:platform="ios" height="1136" src="img/splash/ios/splash_iphone5.png" width="640" /> 
    <gap:platform name="ios" /> 
    <gap:platform name="android" /> 
    <gap:plugin name="org.apache.cordova.inappbrowser" version="0.2.3" /> 
    <gap:plugin name="org.apache.cordova.dialogs" version="0.2.2" /> 
    <gap:plugin name="org.apache.cordova.device-orientation" version="0.3.1" /> 
    <gap:plugin name="org.apache.cordova.core.geolocation" version="0.3.7" /> 
    <gap:plugin name="org.apache.cordova.network-information" version="0.2.7" /> 
    <gap:plugin name="com.phonegap.plugins.pushplugin" version="2.1.1" /> 
    <gap:plugin name="org.apache.cordova.statusbar" /> 
    <feature name="StatusBar"> 
     <param name="ios-package" onload="true" value="CDVStatusBar" /> 
    </feature> 
    <content src="index.html" /> 
    <gap:config-file parent="CFBundleVersion" platform="ios"> 
     <string>1.1.0</string> 
    </gap:config-file> 
    <gap:config-file parent="CFBundleShortVersionString" platform="ios"> 
     <string>1.1.0</string> 
    </gap:config-file> 
    <access origin="*" /> 
    <engine name="android" spec="~4.1.1" /> 
</widget> 

編輯1:

我試圖加入CSP,所以允許從maps.google我的腳本.com我已經使用這個meta標籤:

<meta http-equiv="Content-Security-Policy" content="script-sr 'unsafe-inline' 'unsafe-eval' 'self' https://maps.google.com"> 

和我得到這個錯誤:

拒絕加載腳本 「http://maps.google.com/maps/api/js?sensor=true」,因爲它違反 以下內容安全政策指令:「劇本-SRC 「不安全內聯‘不安全-EVAL’「自我'https://maps.google.com「。

回答

1

看起來像科爾多瓦5.2.2是迫使使用科爾多瓦插件白名單。

我嘗試重新創建科爾多瓦項目,重新添加插件,平臺等 修改www/index.html以包含適當的CSP,如https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy中所建議的。

現在,該應用程序按預期工作。

另外也可以嘗試在現有項目中添加cordova-plugin-whitelist,更新CSP的index.html,然後再次嘗試編譯。我沒有試過這個。

+0

非常感謝這個答案我想要做我的CSP! –

+0

我試圖使用CSP,但暫時不起作用。我只是想允許我使用的所有內容:但我得到的錯誤與以前相同 –

+0

您是否嘗試重新創建科爾多瓦項目? – kkites