2

... or at various settings in the app xml (<appName>-app.xml or application.xml) when holding the phone in Portrait-orientation instead of landscape-orientation.

Depending on various settings our testphone, Samsung Galaxy s3, crashes right at launch when we do debug on the phone in FlashDevelop. Actually we are debugging with a release so we don't get any traces, but all the same we are running the app on the phone.

For instance if we set

<aspectRatio>landscape</aspectRatio>
<autoOrients>true</autoOrients>

and hold the phone in landscape orientation when we start the debug, then the app runs as should be. However if we with the same settings hold the phone in portrait orientation when starting the debug, then the app crashes on startup. The exact same happens if we set auto orient to false and/or remove the Aspect Ratio.

It also doesn't matter what we set stage.scaleMode to in my Main class... or at least i've not been able to figure out any combo with aspectRatio/autoOrients/ that works.

I read something at a glance here at Stack Overflow in another thread about something that seemed similar was a bug in earlier Android versions, but that it should be fixed in ICS (which we have on the test devices). And I may also have seen something at a glance about it being related to the virtual keyboard and to add some code in the xml Manifest at various actions..

Does anyone have a clue for sure please? :-)

edit: The App is built to only ever be shown in Landscape orientation. It can't work in portrait.

Poppe76
  • 394
  • 3
  • 14
  • Reference this http://stackoverflow.com/questions/10679255/android-memory-leak-no-static-variables/10679370#10679370 and this http://stackoverflow.com/questions/456211/activity-restart-on-rotation-android – Pjrat111 Jun 01 '12 at 01:06
  • So far for us it seems the bad guy is stage.addEventListener(Event.DEACTIVATE, someFunc); private function someFunc(e:Event):void { NativeApplication.nativeApplication.exit(); } This gets called for a reason we don't know as of yet, so by removing it the app stops crashing. – Poppe76 Jun 04 '12 at 12:30

1 Answers1

2

I have also encountered same problem; app crashes everytime orientation changes. What I did was very simple:

FIRST, create two folders for your layout:

layout
layout-land

Then, put your portait layouts in layout and landscape layouts in layout-land.

This will do the trick. Hope you can get idea from my experience.

CMA
  • 2,758
  • 5
  • 28
  • 40
  • Ah well that might work somehow :-) However we're only using the landscape orientation, so it really shouldn't rotate to portrait at all.... – Poppe76 Jun 01 '12 at 10:44