Timo Ernst
Timo Ernst

Reputation: 16003

Android app with Phonegap crashes on landscape rotation

I created an Android app with Phonegap. When the app runs and I flip the phone into landscape it simply crashes. I already tried adding this to my manifest:

android:configChanges="orientation|keyboardHidden"

also tried:

android:configChanges="orientation|screenSize|keyboardHidden"

No effect. Any suggestions?


Update:

This is what logcat tells me when the app crashes: http://dl.dropbox.com/u/17844821/zeug/logcat.txt


Update:

This is my manifest file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="de.foo.bar"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="15" />

<supports-screens 
    android:largeScreens="true" 
    android:normalScreens="true" 
    android:smallScreens="true" 
    android:resizeable="true" 
    android:anyDensity="true" />
<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.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:configChanges="orientation|keyboardHidden"
            android:name=".MainActivity"
            android:label="@string/title_activity_main">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

Upvotes: 3

Views: 1245

Answers (2)

Simon MacDonald
Simon MacDonald

Reputation: 23273

Do you have the INTERNET permission in your AndroidManifest.xml? Based on the exception it looks like the CallbackServer can't open a socket which would cause a bunch of problems.

Upvotes: 0

D3GAN
D3GAN

Reputation: 640

Make sure that put those in the activity tag like this:

<activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize
|locale">

and close it after them. I have this problem once and I made this mistake.

Upvotes: 3

Related Questions