有关phonegap的问题

时间:2013-03-08 14:47:42

标签: android cordova runtime-error

我有问题。在设备上启动应用程序时。

image

当我按下“返回”按钮时。

result

Android Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.firstgap"
    android:versionCode="1"
    android:versionName="1.0" >

    <supports-screens android:largeScreens="true" 
                    android:normalScreens="true" 
                    android:smallScreens="true" 
                    android:resizeable="true" 
                    android:anyDensity="true" />

            <uses-permission android:name="android.permission.CAMERA" /> 
            <uses-permission android:name="android.permission.VIBRATE" /> 
            <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_LOCATION_EXTRA_COMMANDS" />
             <uses-permission android:name="android.permission.READ_PHONE_STATE" /> 
             <uses-permission android:name="android.permission.INTERNET" /> 
             <uses-permission android:name="android.permission.RECEIVE_SMS" /> 
             <uses-permission android:name="android.permission.RECORD_AUDIO" /> 
             <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> 
             <uses-permission android:name="android.permission.READ_CONTACTS" /> 
             <uses-permission android:name="android.permission.WRITE_CONTACTS" /> 
             <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
             <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
             <uses-permission android:name="android.permission.GET_ACCOUNTS" /> 
            <uses-permission android:name="android.permission.BROADCAST_STICKY" />
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        android:debuggable="true"
        android:hardwareAccelerated="true" >
        <activity
            android:name="org.apache.cordova.DroidGap"
            android:label="@string/app_name"
            android:configChanges="orientation|keyboardHidden"  >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

MainActivity:

package com.example.firstgap;

import android.os.Bundle;
import org.apache.cordova.DroidGap;

public class MainActivity extends DroidGap {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.loadUrl("file:///android_asset/www/index.html");
    }
}

有什么问题?请帮忙!!!

1 个答案:

答案 0 :(得分:0)

你的Manifest中有糟糕的启动器活动尝试将其更改为:

<activity
    android:name="com.example.firstgap.MainActivity"
    android:label="@string/app_name"
    android:configChanges="orientation|keyboardHidden"  >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
<activity>

您必须实例化com.example.firstgap.MainActivity org.apache.cordova.DroidGap的{​​{1}}。{/ p>