Beta5 - Apps don't work on Android (Nexus One)

My application is running ok in the Corona2.0 simulator Beta 5 but it has some difficulties on Android device (Nexus One).
It starts ok for the first time but when I press Home button on Nexus One and when I launch the app once again it displays an error dialog with the following error message:


Sorry!
The application XY (process unique XY app ID) has stopped unexpectedly. Please try again.

[Force Close]


Do you know what could possibly cause that? Do you have the same experience with your application?

Thanks,
Dusan
[import]uid: 5411 topic_id: 1257 reply_id: 301257[/import]

It looks like that the issue isn’t related just to my application but to any application.
The same happens when I try original sample apps bundled with Corona Beta 5 (e.g. HelloWorld, Fishies, Clock).
All of them work ok on the Nexus One device when I launch them for the first time.
But the error message appears if I click on the app icon and launch the app for a second time.
[import]uid: 5411 topic_id: 1257 reply_id: 3335[/import]

I am with you Dusan, same here. [import]uid: 5712 topic_id: 1257 reply_id: 3338[/import]

To be perfectly honest, apps for Android built with Corona aren’t really usable as of now. I’ve noticed this issue, along with a bunch others. For instance, I have an app that runs flawlessly on iPhone, and then on the Droid which is supposed to be one of the most powerful devices out there, it runs at about 5-10 fps. Unusable.

I realize they are working on it, but it really should be one of their top priorities, getting Android working well. For someone like myself, my team and I are more interested in developing for Android than iPhone since it’s such an easy market to tap right now because of the lack of good games, and I’m sure this goes for a lot of people here.

This is the main reason I purchased Corona, but publishing a game to the Android market with Corona right this moment would be irresponsible.

iPhone/iPod touch on the other hand is a pleasure to work with and I’ve gotten great performance from them. [import]uid: 6678 topic_id: 1257 reply_id: 3339[/import]

Do you know what are the best practices regarding applicationSuspend and applicationResume events on Android ?

Maybe it would be possible to avoid the error by adding piece of code when these two events appear.

Help please…
Dusan
[import]uid: 5411 topic_id: 1257 reply_id: 3375[/import]

I don’t really think there’s much you can do about it. At first I thought it maybe had to do with an enterFrame handler running while the app is in the background, but that’s not it. The issue occurs even if there are no active enterframe handlers.

One thing I have noticed is that sometimes when I go out of my app and then back in the graphics get messed up, almost like some sort of memory issue. Maybe you can try removing all graphics from the screen on suspend, and then putting them back on resume? This is just something I noticed and a guess. In reality, it’s probably just because of the buggy Android support right now and there’s probably no way we can fix it. [import]uid: 6678 topic_id: 1257 reply_id: 3376[/import]

I tried that with Corona Hello World sample code as following but it doesn’t work:


background = display.newImage( “world.png” )
myText = display.newText( “Hello, World!”, 10, 80, “MarkerFelt-Thin”, 60 )
myText:setTextColor( 255,180,90 )

local function onSystemEvent( event )
if (event.type== “applicationSuspend”) then
background.parent:remove(background)
myText.parent:remove(myText)
elseif (event.type== “applicationResume”) then
background = display.newImage( “world.png” )
myText = display.newText( “Hello, World!”, 10, 80, “MarkerFelt-Thin”, 60 )
myText:setTextColor( 255,180,90 )
end
end

Runtime:addEventListener (“system”, onSystemEvent);


What if the error is related to build settings for Android platform?
Have you experimented with that a bit?

Thanks,
Dusan [import]uid: 5411 topic_id: 1257 reply_id: 3377[/import]

No, I haven’t yet. That might be worth trying although I’m not really sure what you’d change. If you discover anything, please let us know. I can’t speak for everyone else, but I really want to develop for Android and these problems are irritating. I’ll let you know if I get it to work. [import]uid: 6678 topic_id: 1257 reply_id: 3378[/import]

I have been testing the Hello World example a bit more and found out that the error appears when I do the following:
…I launch the application right after the installation on Nexus One for the first time.
…I suspend the app by pressing Home button
…And then I resume the app by clicking on its icon in the list of all apps.

But the error doesn’t appear during second launch if I tap on “Done” button after the installation and launch the app form the list of all apps for the first time.

I guess there is an error in Beta5 related to that and it has to be fixed.
Unfortunately without that fix we can’t use Corona for Android apps…

Do you know when Beta6 is going to be released and if I can somehow increase priority of this issue?
[import]uid: 5411 topic_id: 1257 reply_id: 3386[/import]

>>Do you know when Beta6 is going to be released and if I can somehow increase priority of this issue?

Sure, buy out ANSCA and hire more devs. Juuuust kiddin’.

Only time will tell when beta 6 will be out and when things will be fixed. They are providing now the selected devs with their game edition and I am sure ANSCA will concentrate on this now.

Like you guys, I think that the Android version lacks so much and I am convinced that no one can seriously try to publish something for the Android. No network, no native objects, performance problems. I am studying the Android SDK again. I think it will help me in the long run.
Cheers
Michael Hartlef

http://www.whiteskygames.com
http://www.twitter.com/mhartlef
[import]uid: 5712 topic_id: 1257 reply_id: 3388[/import]

Please rest assured that Android is indeed a top priority for us, including resolving these issues. I opened case # 269. [import]uid: 54 topic_id: 1257 reply_id: 3392[/import]

The problem with resume is fixed now. Please try rebuilding your apps. [import]uid: 54 topic_id: 1257 reply_id: 3394[/import]

Hi Eric,
Thanks you are trying to solve the issue.

I rebuilt the Hello World code mentioned above and the error still appears when I do the following:
…I Open the application right after its installation for the first time (By tapping on “Open” button after installation).
…I suspend the app by pressing Home button
…And then I resume the app by tapping on its icon in the list of all apps.

Then the following error appears every time I launch the app:

Sorry!
The application HelloWorld (process com.mydomainname.hello) has stopped unexpectedly. Please try again.

[Force Close]


I tried those steps with the original HelloWorld code too:

background = display.newImage( “world.png” )

myText = display.newText( “Hello, World!”, 10, 80, “MarkerFelt-Thin”, 60 )
myText:setTextColor( 255,180,90 )

But unfortunately with the same result.

[import]uid: 5411 topic_id: 1257 reply_id: 3395[/import]

1.5 or 2.0?
How are you installing the app on device? If you haven’t already, can you try removing old version from the phone manually? [import]uid: 54 topic_id: 1257 reply_id: 3397[/import]

I just tried it too, and I still have the problem. I’m building for 2.0. I can also confirm that I installed properly since I saw visual changes to my game that weren’t there before.

Anyway, I see this issue slightly differently. When I go into my game, and hit the home key, and go back in, I rarely get that error. But, what I do usually get is a black screen and I don’t see anything. Sometimes after hitting home and going back in a few times it’ll show up. Now, when it does show up, there’s definitely something funky going on with the memory. Graphics get mixed up. For example, I have a ball and a timer. Sometimes, the timer will be in the place of the ball and the ball will be gone. Just weird stuff like that. Not sure if that helps… [import]uid: 6678 topic_id: 1257 reply_id: 3398[/import]

I am building for 2.0 too and I was installing the file from a web URL. I did remove the old version first. I downloaded the Hello World app and then went through the following steps:
…I clicked on downloaded file and the installation started.
…I launched the application right after its installation for the first time (By tapping on “Open” button after installation).
…I suspended the app by pressing Home button
…And then I resumed the app by tapping on its icon in the list of all apps.

The error always appears if I do these steps. [import]uid: 5411 topic_id: 1257 reply_id: 3401[/import]

I have this problem under 1.5 on my G1 and my own game too. Did not test the new server coder. [import]uid: 5712 topic_id: 1257 reply_id: 3403[/import]

Ok. With 1.5, I see the issue with resume coming back with a black screen, or in the case of an animation, a white screen. I’ll investigate that. [import]uid: 54 topic_id: 1257 reply_id: 3407[/import]

This goes for me too, I can’t get my apps to work on the Nexus One. In the simulator - they run, but on Nexus One I get no sounds no matter what format I put them in.
[import]uid: 9046 topic_id: 1257 reply_id: 6000[/import]

@MBD, there is a known issue if multiple sounds with the same basename but different extensions exists in the project folder. An easy workaround is to name them differently – internally we’ve switched our sample code to something like “sound_mp3.mp3” and “sound_caf.caf”, and load them conditionally based on the active platform. [import]uid: 54 topic_id: 1257 reply_id: 6003[/import]