Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
New Contributor
Posts: 8
Registered: ‎06-08-2011
My Device: Playbook & Dev Alpha B
My Carrier: 3

App dies when deactivating

My app often (but not always) crashes/shuts down when I switch out of it. I get a DEACTIVATE event and then the app just closes down without any sort of exception or error.

 

The app consists of a number of qnx.ui.display.Image instances as well as some mp3 files. I don't seem to be getting any low memory events and the app works fine as long as I don't try to switch out of it. I have an ENTER_FRAME event handler which does some animation.

 

If I attach a debugger, it just says the debugging session ended without any other output. Has anyone seen similar behavior in their app?

 

Thomas

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: App dies when deactivating

I haven't heard of anything similar, and would think it's just an app bug (i.e. in your own code).

This looks like a good opportunity, if you have a PlayBook, and if the problem is 100% repeateable, to try "divide-and-conquer" troubleshooting. Chop out some major chunks of code, preferably in the areas you think are related, and run again. If it stops terminating, add some of that code back in again, and so on. Basically you're doing a binary search to narrow down the possible causes.

I would imagine the first step would be simply to disable your DEACTIVATE handler (possibly by commenting out everything inside the event listener except a trace() statement to prove it got there). If the app stops crashing when you switch away, you know it's something directly related to what you call from there.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
New Contributor
Posts: 8
Registered: ‎06-08-2011
My Device: Playbook & Dev Alpha B
My Carrier: 3

Re: App dies when deactivating

Well, I tore everything out and it still crashes. So I tried making a new project with just one Image. Still crashes as soon as I try to switch out of the app. I've narrowed it down to the following:

 

package {
	import flash.display.Sprite;
	import qnx.ui.display.Image;
	public class Main extends Sprite {
		public function Main():void  {
			super();
			var fooImage:Image = new Image();
			fooImage.setImage("image.png");
			addChild(fooImage);
		}		
	}
}

 

I've uploaded the code, assets and FlashDevelop project here in case anyone wants to have a look:

 

http://www.itu.dk/~tnjr/MP3Test.zip

 

I don't get it. Either I'm doing something very wrong, or the qnx Image class is broken. I'm usually very hesitant to blame the platform sdks, but there's not a lot of room for bugs in the above code. Smiley Happy

 

Thomas

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: App dies when deactivating

Kudos for taking the time to strip it down to bare essentials.  If everyone around here did that, our jobs would be a lot easier!

 

Unfortunately, after throwing in a stray PNG (489x309) and building, putting my tablet into Paused mode instead of Default, then repeatedly bottom-swiping to minimize and tapping the app to full-screen it again, at least 50 times, I get no sign of trouble.

 

Here are my build commands.  You could do the same manually at the command line and see whether that changes anything.  I'm using SDK 1.0.1: maybe check that you're not inadvertently stuck on an older one.

amxmlc -debug -output ThomasRiisbjerg.swf ThomasRiisbjerg.as
blackberry-airpackager -package -devMode -target bar ThomasRiisbjerg.bar application.xml 
blackberry-tablet.xml ThomasRiisbjerg.swf image.png blackberry-deploy -installApp -launchApp -device PBIP -password PBPASS -package ThomasRiisbjerg.bar

 


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 231
Registered: ‎05-03-2011
My Device: PlayBook V1 and proud of it :-)
My Carrier: Legs

Re: App dies when deactivating

Just notice you have void as a return type on the constructor, dont know if it matters as thats what constructors basically do anyhoo, but they're not allows to specify a return type.

 

Also I doubt very much it's the qnx class as I feel it would have been spotted before now, create a complete new project with the qnx class and without the class.

Keep the Forum productive and useful for all. Click Kudos button if I've helped you. Select Solved to help everyone.

PlayBook qualifying app - Pandoras' Lights
Blog - CoCopia.co.uk Catch me on Twitter cocopia_apps
New Contributor
Posts: 8
Registered: ‎06-08-2011
My Device: Playbook & Dev Alpha B
My Carrier: 3

Re: App dies when deactivating

Just a quick follow-up. My app no longer crashes in 1.0.6. It also turns out that RIM disabled GPU rendering in 1.0.6. We'll see if the crashes return if/when they re-enable GPU rendering.

 

*shrug*

 

Thanks for all the suggestions so far!