31 May 2013, 20:23
Generic-user-small

Andrew Davis (13 posts)

I tried to load up the “Shooting” apk on my phone (Droid RAZR Maxx), it installed correctly. It works great on the simulator, but on my device, it won’t go past the title screen.

And with my own game created with Corona, it installs, but when I launch it, I just see a black screen, and then it crashes after awhile.

Any idea how to figure this one out?

Have you been able to run any of them on an Android?

Thanks, Andy

01 Jun 2013, 14:29
Silvias_temp_avatar_pragsmall

Silvia Domenech (35 posts)

Hi Andy,

I normally use iDevices, so I haven’t deployed the book’s projects on my Android phone in the past few months. The problems may have been caused by one of the recent changes in the book’s codes, or there could be some type of incompatibility.

I won’t have access to the PC where I have Corona installed until Monday, but I’ll check the Android deployment process step by step and try to find the possible cause of the errors. I don’t have the specific phone you mentioned, but I’ll ask around to see if someone I know has a similar phone (or if we can get it to behave in the same way).

I’ll experiment and get back to you then.

Silvia

01 Jun 2013, 16:50
Generic-user-small

Andrew Davis (13 posts)

Thanks Silvia :) I really appreciate it!

03 Jun 2013, 08:02
Silvias_temp_avatar_pragsmall

Silvia Domenech (35 posts)

Hi Andy,

Were you having problems with the book’s other projects (such as Parallax)?

If you were only having problems with Shooting (or Sound), then you only have to remove one file. The project folder includes a “physics.lua” file used in the book to show how to define physics shapes (but it is unrelated to the project). When Corona compiles the project, it takes that file instead of the real physics.lua from the SDK. If you remove the file, it should work on your phone.

If you’re getting more error messages, try to launch the android debug program (adb logcat if you have the Android SDK installed) while your computer is connected to the phone, and tell me what you get once it freezes. You can set Corona to verbose and filter other messages using adb logcat Corona:V *:S, or try with other debugging options. Your phone needs to have its debug options enabled to get debugging messages.

Your game might be crashing because of a Lua error. Sometimes, it’s only a matter of fixing a variable name, but the easiest way to spot why it is not working is to get the debug output.

Silvia

04 Jun 2013, 22:15
Generic-user-small

Andrew Davis (13 posts)

Silvia,

It didn’t seem to be physics.lua related. I did run it through the logcat and I saw the message:

Inputdispatcher: channel `41b326e0 com.example.mygame/com.ansca.corona.CoronaActivity (server)’ ~ Channel is unrecoverably broken and will be disposed!

It seems it is the same error found here: http://forums.coronalabs.com/topic/28046-unable-to-run-application-on-bosses-android-phone/

My phone is Android 4.1.2.

04 Jun 2013, 23:33
Silvias_temp_avatar_pragsmall

Silvia Domenech (35 posts)

Andy,

I got an error when trying to load Shooting, and removing physics.lua solved it, so I had assumed we were getting the same error. It looks like we were getting different errors.

I’m very confused about the crash message (about the broken channel). When Corona apps encounter a code-related error, I have always seen it mention the function that is causing it, or at least something to be able to debug the program. That message doesn’t tell you if it is a texture-related error, a code error, or something specific in one of the functions.

If it’s a bug in Corona, I won’t be able to help, but we can try to discard the possibility that the problem is code-related. Were you able to run any Corona sample apps (such as the physics demos) on the phone? The error might be linked to one of the functions used in the book’s code, even if it does not cause problem in other devices.

Silvia

05 Jun 2013, 21:22
Generic-user-small

Andrew Davis (13 posts)

I came across:

http://forums.coronalabs.com/topic/14439-error-in-android/?hl=%2Bchannel+%2Bis+%2Bunrecoverably+%2Bbroken+%2Band+%2Bwill+%2Bbe+%2Bdisposed%26%2333%3B

Looks like audio might be an issue, I’m going to try to disable all audio and see what happens.

05 Jun 2013, 21:22
Generic-user-small

Andrew Davis (13 posts)

I have tried in the past to run one of the Corona sample apps on my device, and I also encounter the same error. Starting to think it might be my phone… but I would consider it a high end device, not sure why it wouldn’t work.

I’ll try to load up one of the sample apps again. In the event I don’t make progress, maybe I could add you as a collaborator on my project in BitBucket and you could clone the code?

05 Jun 2013, 21:40
Generic-user-small

Andrew Davis (13 posts)

Sorry for the thread spam.

Okay, the “Chains” sample app in the Physics section does indeed work on my phone. So I can’t rule that out. I commented out everything audio, but still having trouble with the same error.

I’m seeing it in the “adb logcat Corona:V *:E” log. I’ll keep looking.

06 Jun 2013, 22:56
Silvias_temp_avatar_pragsmall

Silvia Domenech (35 posts)

Hi Andy,

Perhaps the fact that your phone is quite new is what makes it less compatible with Corona. It might be a matter of waiting for the next Corona public releases.

The sample apps should definitely work on any phone (since they’re designed to do so), so the best course of action is probably to write a bug report to the Corona team and hope they get it fixed soon. It must be really frustrating for you not to be able to run some Corona-made games on your phone.

In the meantime, since you’re not getting any useful details from adb logcat, I’m going to suggest a somewhat messy solution: try adding “print” statements (such as “fine until part x”) in several parts of the code, and you’ll be able to tell when the error happens. That might make it possible to detect the specific API call (or calls) that cause the errors.

I’d like to help more, but since I can’t replicate these errors, I can’t think of many ways of helping you. Keep me updated if you try the “print” strategy. We might not be able to fix the problem if it’s a phone-related issue, but there might be an alternate solution that can be used in the meantime.

Silvia

06 Jun 2013, 23:11
Generic-user-small

Andrew Davis (13 posts)

Good plan. Now if I add print statements and try to run it on my phone, where will I see the Corona output? Will that show up in ADB?

07 Jun 2013, 02:12
Silvias_temp_avatar_pragsmall

Silvia Domenech (35 posts)

Yes, you’ll have to use the debugger and they will appear in ADB.

07 Jun 2013, 22:57
Generic-user-small

Andrew Davis (13 posts)

Problem has been solved!

physics.setGravity(0, 0)

That does not work at all. I thought I had seen it in the book’s code somewhere (maybe just the included source code, I can’t remember)

After commenting out that particular line (after lots of print statement debugging as suggested) it finally works :)

Thank you for your dedication to helping me make this work!

10 Jun 2013, 00:38
Silvias_temp_avatar_pragsmall

Silvia Domenech (35 posts)

Hi Andy,

Wow, I didn’t know that disabling gravity that way caused problems on some phones. Some people got errors when using setGravity() before physics.start(), but I had not seen setGravity cause any problems when setting it to zero.

I am delighted that it’s finally working on your phone!

Silvia

10 Jun 2013, 02:05
Generic-user-small

Andrew Davis (13 posts)

I haven’t tried to put it back in, but you’re right. “setGravity” was being called before physics.start. At least according to the book’s source code, so might want to update that.

Thanks again for the help!

10 Jun 2013, 11:38
Silvias_temp_avatar_pragsmall

Silvia Domenech (35 posts)

Oh, I think that had been updated in Beta 2.0. If you want, you can download the newest code files (here) and try to run those.

Silvia

  You must be logged in to comment