0

我用 phonegap 2.9.0 和 jQuery mobile 开发了一个 android 应用程序。当我将文件 config.xml 放在 res/xml 文件夹中时。应用程序未启动并在 logcat 中显示此异常:

09-28 10:09:10.576: E/AndroidRuntime(1653): java.lang.RuntimeException: 在 org.apache.cordova 中接收广播 Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x8000010 (has extras) } 时出错.NetworkManager$1@41749d08

这是我的config.xml

<widget xmlns     = "http://www.w3.org/ns/widgets"
        id        = "io.cordova.helloCordova"
        version   = "2.0.0">
    <name>Mousse</name>

    <description>
        Un générateur d'éponges
    </description>

    <author href="http://cordova.io" email="dev@cordova.apache.org">
        Bob l'éponge - Monsieur Propre
    </author>

    <access origin="*"/>

    <!-- <content src="xxxx" /> for external pages -->
    <content src="index.html" />

    <preference name="loglevel" value="DEBUG" />
    <!--
      <preference name="splashscreen" value="resourceName" />
      <preference name="backgroundColor" value="0xFFF" />
      <preference name="loadUrlTimeoutValue" value="20000" />
      <preference name="InAppBrowserStorageEnabled" value="true" />
      <preference name="disallowOverscroll" value="true" />
    -->

    <feature name="App">
      <param name="android-package" value="org.apache.cordova.App"/>
    </feature>
    <feature name="Geolocation">
      <param name="android-package" value="org.apache.cordova.GeoBroker"/>
    </feature>
    <feature name="Device">
      <param name="android-package" value="org.apache.cordova.Device"/>
    </feature>
    <feature name="Accelerometer">
      <param name="android-package" value="org.apache.cordova.AccelListener"/>
    </feature>
    <feature name="Compass">
      <param name="android-package" value="org.apache.cordova.CompassListener"/>
    </feature>
    <feature name="Media">
      <param name="android-package" value="org.apache.cordova.AudioHandler"/>
    </feature>
    <feature name="Camera">
      <param name="android-package" value="org.apache.cordova.CameraLauncher"/>
    </feature>
    <feature name="Contacts">
      <param name="android-package" value="org.apache.cordova.ContactManager"/>
    </feature>
    <feature name="File">
      <param name="android-package" value="org.apache.cordova.FileUtils"/>
    </feature>
    <feature name="NetworkStatus">
      <param name="android-package" value="org.apache.cordova.NetworkManager"/>
    </feature>
    <feature name="Notification">
      <param name="android-package" value="org.apache.cordova.Notification"/>
    </feature>
    <feature name="Storage">
      <param name="android-package" value="org.apache.cordova.Storage"/>
    </feature>
    <feature name="FileTransfer">
      <param name="android-package" value="org.apache.cordova.FileTransfer"/>
    </feature>
    <feature name="Capture">
      <param name="android-package" value="org.apache.cordova.Capture"/>
    </feature>
    <feature name="Battery">
      <param name="android-package" value="org.apache.cordova.BatteryListener"/>
    </feature>
    <feature name="SplashScreen">
      <param name="android-package" value="org.apache.cordova.SplashScreen"/>
    </feature>
    <feature name="Echo">
      <param name="android-package" value="org.apache.cordova.Echo"/>
    </feature>
    <feature name="Globalization">
      <param name="android-package" value="org.apache.cordova.Globalization"/>
    </feature>
    <feature name="InAppBrowser">
      <param name="android-package" value="org.apache.cordova.InAppBrowser"/>
    </feature>
    <!-- Deprecated plugins element. Remove in 3.0 -->
    <plugins>
    </plugins>
</widget>

如果我删除了功能应答器,那么我没有这个问题并且程序启动,但我在电话屏幕上出现错误:

初始化 cordova.xml 时出错,找不到类。

我该如何解决这个问题?非常感谢

4

1 回答 1

1

添加

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

AndroidManifest.xml我工作。谢谢,Prodeveloper。

于 2013-11-14T07:10:00.483 回答