Friday, February 15, 2013

Debugging Latest Issues

We've just recently discovered issues when running the app on a device. What happens is the app locks up on the training level. What is strange about this is that when running in the simulator we don't see any error messages or warnings that indicate problems at that point.

To try to get to the bottom of this, I started looking into ways to debug an app while it's running on a device. I had already installed the android sdk on my pc and figured there must be some debugging capability built in. I looked around and found a pretty good amount of documentation from Google (and other sources) on how to use it. Here is a summary of one way I've found to do some debugging.

- I first connect my device (Galaxy S3) to my windows pc, where I have the Android SDK installed.
- Then I open a command line in the folder android-sdk\platform-tools, which is where the 'android debug bridge' tool is found (adb.exe).
- Then, I make sure my device is recognized by typing adb devices (I had to install the correct driver from Samsung because it wasn't recognizing it at first).
- Then I type adb logcat Corona:V *:S. I found that tip here: http://developer.coronalabs.com/forum/2012/08/08/debugging-device-tips-and-tricks
- Then I launch the app on my device. The display messages and errors now show up on my pc in a terminal window while running the app.

Looking back, it would have helped if I had figured out how to do this from the beginning so we could monitor for issues all along! Ugh. But we haven't run into this type of issue until now where the app runs into problems on the device, but not in the simulator.

Although I still have a ways to go to know what the problem is, I have made some progress while debugging. At first I was seeing a runtime error that seemed related to the ship rotation that I had put in over the xmas break. Error message was:
Lua Runtime Error: lua_pcall failed with status: 2, error message: ...level1.lua:485: attempt to index upvalue 'ship' (a nil value)

So I removed the ship rotation from the code to see if that fixes the problem. But now while on training level 1, I see this each time I destroy a ship:
Lua Runtime Error: lua_pcall failed with status: 2, error message is: ...x folder/depaul se491/Flights_Of_Fancy_Main/json.lua:309: Failed to load string [ return "totalScore"] in JSON4Lua.decode_scanString at position 2 : 14

The game continues to run fine for a bit, but after that message pops up in the terminal a whole bunch of times (once for each time I kill an enemy ship), the debug terminal stops logging the messages. Then shortly after that (sometimes after the boss appears, sometimes before) the app locks up. 

Still debugging, but that's latest I'm seeing. Hope to make more progress this week!

No comments:

Post a Comment