Cordova Android无法加载资源:net :: ERR_NAME_NOT_RESOLVED

我今天升级到最新的Cordova – 5.4.1. iOS上的应用程序保持正常工作,但不适用于 Android.所有请求都返回404错误,所以我深入研究了主题,发现我需要“cordova-plugin-whitelist”.我安装了它并添加了

< meta http-equiv =“Content-Security-Policy”content =“default-src *'unsafe-inline''unsafe-eval'”>

到index.html的标题以及< access origin =“*”/>< allow-navigation href =“*”/>到config.xml

现在每个对外部世界的请求都返回“net :: ERR_NAME_NOT_RESOLVED”

在AndroidManifest.xml中,我有这两行,所以我猜这不是Internet访问的问题.

< uses-permission android:name =“android.permission.INTERNET”/>
< uses-permission android:name =“android.permission.ACCESS_WIFI_STATE”/>

我经历了很多与cordova-plugin-whitelist相关的问题,但似乎没什么用

我的config.xml
“`

<?xml version='1.0' encoding='utf-8'?>
<widget id="app" version="1.1.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>app</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <allow-navigation href="*" />
    <platform name="ios">...splash screens and icons</platform>
    <platform name="android">...splash screens and icons</platform>
    <icon src="resources/android/icon/drawable-xhdpi-icon.png" />
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="3000" />
    <preference name="Orientation" value="default" />
    <feature name="phonegap-parse-plugin">
        <param name="id" value="org.apache.cordova.core.parseplugin" />
        <param name="url" value="https://github.com/fastrde/phonegap-parse-plugin" />
    </feature>
    <feature name="Insomnia (prevent screen sleep)">
        <param name="id" value="nl.x-services.plugins.insomnia" />
        <param name="url" value="https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git" />
    </feature>
    <feature name="Toast">
        <param name="id" value="cordova-plugin-x-toast" />
        <param name="url" value="https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git" />
    </feature>
    <feature name="Cordova SMS Plugin">
        <param name="id" value="com.cordova.plugins.sms" />
        <param name="url" value="https://github.com/cordova-sms/cordova-sms-plugin.git" />
    </feature>
    <feature name="OpenTokCordovaPlugin">
        <param name="id" value="com.tokbox.cordova.opentok" />
        <param name="url" value="https://github.com/doxyme/cordova-plugin-opentok" />
    </feature>
</widget>

“`

我不知道问题是什么,但重启设备解决了它.与该应用程序无关,只是手机连接到互联网时遇到困难,即使它连接到Wi-Fi并且信号强度似乎最大.
相关文章
相关标签/搜索