Robertas Setkus
Robertas Setkus

Reputation: 3161

Android (Phonegap) crash on rotate

I googled that an activity element needs android:configChanges="orientation|screenSize|keyboardHidden" value for PhoneGap to refresh screen dimensions. But then Eclipse pukes that there is an error: error: Error: String types not allowed (at 'configChanges' with value 'orientation|screenSize|keyboardHidden').. So what is wrong with my manifest configuration? Here is my whole Android manifest configuration:

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

    <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.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.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" />


    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" android:debuggable="true" android:testOnly="false">
        <activity
            android:name=".IndexActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:configChanges="orientation|screenSize|keyboardHidden">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

As you can see I installed all versions above 3.2 My Android SDK Manager window

Still getting an error on As you can see I installed all versions above 3.2 My manifest file

Upvotes: 2

Views: 2411

Answers (2)

MRT
MRT

Reputation: 1610

Try this, Just copy paste this code.

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

    <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.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.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" />


    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" android:debuggable="true" android:testOnly="false">
        <activity
            android:name=".IndexActivity"
            android:label="@string/app_name"
            android:configChanges="orientation|keyboardHidden" 
            android:screenOrientation="portrait">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

Upvotes: 2

Kyriog
Kyriog

Reputation: 848

Try to invert screenSize and keyboardHidden.

screenSize have been added in SDK version 13. If you try to start your application on Android 3.1 or lower, it can't work because the SDK can't find screenSize value.

By the way, Phonegap starting guide recommends this value for configChanges:

android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"

Upvotes: 1

Related Questions