我刚刚设置了一个 Android/Cordova 2.0.0 应用程序,其中除了 Cordova“入门”指南中的简单索引页面外几乎没有任何内容。
但我越来越“不幸的是,当我在 4.0.3 模拟器中运行项目时,应用程序立即停止。我可以运行我已经完成的旧项目没有问题。
这是 logCat 内容:
08-21 09:13:30.881: E/AndroidRuntime(529): FATAL EXCEPTION: main
08-21 09:13:30.881: E/AndroidRuntime(529): java.lang.SecurityException: ConnectivityService: Neither user 10040 nor current process has android.permission.ACCESS_NETWORK_STATE.
08-21 09:13:30.881: E/AndroidRuntime(529): at android.os.Parcel.readException(Parcel.java:1327)
08-21 09:13:30.881: E/AndroidRuntime(529): at android.os.Parcel.readException(Parcel.java:1281)
08-21 09:13:30.881: E/AndroidRuntime(529): at android.net.IConnectivityManager$Stub$Proxy.getActiveNetworkInfo(IConnectivityManager.java:597)
08-21 09:13:30.881: E/AndroidRuntime(529): at android.net.ConnectivityManager.getActiveNetworkInfo(ConnectivityManager.java:365)
08-21 09:13:30.881: E/AndroidRuntime(529): at org.apache.cordova.NetworkManager.execute(NetworkManager.java:124)
08-21 09:13:30.881: E/AndroidRuntime(529): at org.apache.cordova.api.PluginManager.exec(PluginManager.java:218)
08-21 09:13:30.881: E/AndroidRuntime(529): at org.apache.cordova.CordovaChromeClient.onJsPrompt(CordovaChromeClient.java:207)
08-21 09:13:30.881: E/AndroidRuntime(529): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:600)
08-21 09:13:30.881: E/AndroidRuntime(529): at android.os.Handler.dispatchMessage(Handler.java:99)
08-21 09:13:30.881: E/AndroidRuntime(529): at android.os.Looper.loop(Looper.java:137)
08-21 09:13:30.881: E/AndroidRuntime(529): at android.app.ActivityThread.main(ActivityThread.java:4424)
08-21 09:13:30.881: E/AndroidRuntime(529): at java.lang.reflect.Method.invokeNative(Native Method)
08-21 09:13:30.881: E/AndroidRuntime(529): at java.lang.reflect.Method.invoke(Method.java:511)
08-21 09:13:30.881: E/AndroidRuntime(529): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-21 09:13:30.881: E/AndroidRuntime(529): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-21 09:13:30.881: E/AndroidRuntime(529): at dalvik.system.NativeStart.main(Native Method)
这是我的 androidManifest 文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.active.myApp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".myAppActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
和我的活动文件:
package com.active.myApp;
import android.app.Activity;
import android.os.Bundle;
import org.apache.cordova.*;
public class myAppActivity extends DroidGap {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
super.loadUrl("file:///android_asset/www/index.html");
}
}
请问有什么帮助吗?