当切换方向,即使AndroidManifest变化PhoneGap的应用程序崩溃 [英] Phonegap app crashes when switched orientation even with AndroidManifest changes

查看:200
本文介绍了当切换方向,即使AndroidManifest变化PhoneGap的应用程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mappp.mobile"
    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.hardware.camera" />
    <uses-permission android:name="android.hardware.camera.autofocus" />
    <uses-sdk android:minSdkVersion="13" /> 

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:debuggable="true" 
        android:configChanges="orientation|screenSize|keyboardHidden"  >
        <activity
            android:label="@string/app_name"
            android:name=".MAppHDActivity" >
             <intent-filter >
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity 
            android:name="com.phonegap.DroidGap" 
            android:label="@string/app_name" 
            android:configChanges="orientation|screenSize|keyboardHidden" > 
            <intent-filter>
            </intent-filter>
        </activity>
    </application>

</manifest>

我使用PhoneGap的1.3.0和jquerymobile。

I'm using Phonegap 1.3.0 and jquerymobile.

我的测试设备是三星Galaxy Tab 8.9与HC V3.2。

My test device is a Samsung Galaxy Tab 8.9 with HC v3.2.

我看过几乎每一个论坛,同样的问题。当我旋转屏幕仍然失败。

I've read ALMOST every forum with the same issue. It still fails when i rotate the screen.

有一个警告在调试模式下的应用程序崩溃之后:WebCore的:第一个布局后无法得到veiwWidth

There's a warning right after the app crashes in debug mode: webcore: Can't get the veiwWidth after the first layout.

推荐答案

在你的情况下,属性安卓configChanges =定位|屏幕尺寸| keyboardHidden应到第一个&LT;活性GT; 标签,而不是&lt;应用&GT; 标记

In your case the attribute android:configChanges="orientation|screenSize|keyboardHidden" should go to the first <activity> tag and not the <application> tag.

对于有类似问题的其他人只需添加屏幕尺寸安卓configChanges =方向| keyboardHidden或修改机器人:的minSdkVersion 属性为12或更低

For the other people having similar issues simply add screenSize to android:configChanges="orientation|keyboardHidden" or change the android:minSdkVersion attribute to 12 or lower.

此行为的更详细的解释可以在这里找到:<一href="http://groups.google.com/group/phonegap/msg/c771fffc4dd9daaf">http://groups.google.com/group/phonegap/msg/c771fffc4dd9daaf

A more detailed explanation of this behavior can be found here: http://groups.google.com/group/phonegap/msg/c771fffc4dd9daaf

这篇关于当切换方向,即使AndroidManifest变化PhoneGap的应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆