Android crash on rotation event [CLOSED]

Hello everyone,

I want to enable rotation for my app on android, but I get a crash before I even get the resizing event.

Here is the logcat output before the crash:

02-16 09:49:11.802 27670-27670/org.visualproductions.kiosc V/SDL: onPause()
02-16 09:49:11.802 27670-27670/org.visualproductions.kiosc V/SDL: nativePause()
02-16 09:49:11.802 27670-27670/org.visualproductions.kiosc E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
02-16 09:49:11.906 27670-27670/org.visualproductions.kiosc D/ActivityThread: ACT-AM_ON_PAUSE_CALLED ActivityRecord{204a1f86 token=android.os.BinderProxy@3cce7047 {org.visualproductions.kiosc/org.libsdl.app.SDLActivity}}
02-16 09:49:11.906 27670-27670/org.visualproductions.kiosc V/SDL: onDestroy()
02-16 09:49:12.012 27670-27699/org.visualproductions.kiosc D/GraphicBuffer: unregister, handle(0xa3e11100) (w:1024 h:552 s:1024 f:0x1 u:0x000f02)
02-16 09:49:12.012 27670-27699/org.visualproductions.kiosc D/GraphicBuffer: unregister, handle(0xa33833a0) (w:1024 h:552 s:1024 f:0x1 u:0x000f02)
02-16 09:49:12.012 27670-27699/org.visualproductions.kiosc D/GraphicBuffer: unregister, handle(0xa3383220) (w:1024 h:552 s:1024 f:0x1 u:0x000f02)
02-16 09:49:12.013 27670-27699/org.visualproductions.kiosc D/GraphicBuffer: unregister, handle(0xa33830a0) (w:1024 h:552 s:1024 f:0x1 u:0x000f02)
02-16 09:49:12.024 27670-27702/org.visualproductions.kiosc W/art: Native thread exiting without having called DetachCurrentThread (maybe it’s going to use a pthread_key_create destructor?): Thread[17,tid=27702,Native,Thread*=0xb092a400,peer=0x12d26080,“Thread-1808”]
02-16 09:49:12.336 27670-27704/org.visualproductions.kiosc W/art: Native thread exiting without having called DetachCurrentThread (maybe it’s going to use a pthread_key_create destructor?): Thread[19,tid=27704,Native,Thread*=0xb032a400,peer=0x12d36080,“Thread-1810”]
02-16 09:49:12.337 27670-27699/org.visualproductions.kiosc A/libc: /Volumes/Android/buildbot/src/android/ndk-r14-release/external/libcxx/…/…/external/libcxxabi/src/abort_message.cpp:74: void abort_message(const char *, …): assertion “terminating with uncaught exception of type NSt6__ndk112system_errorE: thread::join failed: No such process” failed
02-16 09:49:12.338 27670-27699/org.visualproductions.kiosc A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 27699 (SDLThread)

This is probably not helpful at all, but in my app Android orientation events work fine and I’ve not encountered any problems with them. I’m using SDL 2.0.5 because I haven’t acquired enough confidence in later releases to risk updating.

In my AndroidManifest.xml I have:

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

and in my SDL event handler I’m responding to SDL_WINDOWEVENT with sub-category SDL_WINDOWEVENT_RESIZED.

Richard.

Hello rtrussell,

I have orientation set in my AndroidManifest and I am also using 2.0.5 since 2.0.7 broke my project.
It happens before I even get the event so its nearly impossible to figure out what is the problem.

Greetings.

Hi Maarten,

in case you were expecting to handle rotation yourself, instead of what’s
currently happening to you in that the Android system is trying to handle it
(by destroying and recreating your app from scratch), then you should try
Richards suggestion. By declaring the events you wish to handle yourself in
the manifest, you avoid Android handling them for you.

Regards,

Daniel

---------- Původní e-mail ----------
Od: Maarten Engels noreply@discourse.libsdl.org
Komu: hardcoredaniel@seznam.cz
Předmět: Re: [SDL] Android crash on rotation event
"

 maartenengels(https://discourse.libsdl.org/u/maartenengels) 

February 19

Hello rtrussell,

I have orientation set in my AndroidManifest and I am also using 2.0.5 since
2.0.7 broke my project.
It happens before I even get the event so its nearly impossible to figure
out what is the problem.

Greetings.

HEllo hardcoredaniel,

Thats exactly what I am doing. Below I have posted my Manifest.xml

activity android:name=".SDLActivity"
android:configChanges=“keyboardHidden|orientation"
android:label=”@string/app_name"

Greetings,

You need to add “screenSize”.

---------- Původní e-mail ----------
Od: Maarten Engels noreply@discourse.libsdl.org
Komu: hardcoredaniel@seznam.cz
Předmět: Re: [SDL] Android crash on rotation event
"

 maartenengels(https://discourse.libsdl.org/u/maartenengels) 

February 21

HEllo hardcoredaniel,

Thats exactly what I am doing. Below I have posted my Manifest.xml
"
activity android:name=".SDLActivity"
android:configChanges=“keyboardHidden|orientation"
android:label=”@string/app_name"
"
Greetings,

Thank you! That has fixed it for me.

Greetings.