Easiest DETAILED way to debug corona app on android device?

Can someone please explain a detailed exact method of easily debugging a corona app? I have made sure all my png files are ok case wise, no errors in my build.settings as its the standard corona template and has worked perfectly with other apps i created.

Ive attached my code files and if someone could take a look it would be greatly appreciated.  Thanks

Read this article:

http://docs.coronalabs.com/guide/distribution/androidBuild/index.html

Go to the “Debugging” block at the bottom.   You need to get the ADB tools installed.  Once you have that installed, you can open up a command line prompt (Terminal on a Mac, cmd on Windows).  Then use the command:

 

adb logcat Corona:v *:s

That will show you only messages generated by Corona.  You look for errors, warnings printed by the system or you can watch for your own “print” statements that you add to your code.

Read this article:

http://docs.coronalabs.com/guide/distribution/androidBuild/index.html

Go to the “Debugging” block at the bottom.   You need to get the ADB tools installed.  Once you have that installed, you can open up a command line prompt (Terminal on a Mac, cmd on Windows).  Then use the command:

 

adb logcat Corona:v *:s

That will show you only messages generated by Corona.  You look for errors, warnings printed by the system or you can watch for your own “print” statements that you add to your code.

Excellent! I went through the same, changed file names, etc, but no luck.

After reading this post I tried with Rob’s solution and found out that I was using iAds on an android build and that was the problem.

Thanks Rob!!

Excellent! I went through the same, changed file names, etc, but no luck.

After reading this post I tried with Rob’s solution and found out that I was using iAds on an android build and that was the problem.

Thanks Rob!!

This is good, but in my case I’m not dealing with an obvious error, just undesirable behavior on the android device. Is there any way whatsoever to do live debugging of an app on an android device? I’m talking about setting breakpoints and inspecting variables within the program while it is stopped at a breakpoint.

Yep, debugging (as in setting breakpoints, not just reading log output) can be done. For example, with ZeroBrane Studio:

http://notebook.kulchenko.com/zerobrane/corona-on-device-debugging-with-zerobrane-studio

Sweet!  Thanks, _memo, that was what I needed.

This is good, but in my case I’m not dealing with an obvious error, just undesirable behavior on the android device. Is there any way whatsoever to do live debugging of an app on an android device? I’m talking about setting breakpoints and inspecting variables within the program while it is stopped at a breakpoint.

Yep, debugging (as in setting breakpoints, not just reading log output) can be done. For example, with ZeroBrane Studio:

http://notebook.kulchenko.com/zerobrane/corona-on-device-debugging-with-zerobrane-studio

Sweet!  Thanks, _memo, that was what I needed.

I’ll just add something that might be useful for others.

Limiting logging output only to Corona may hide a lot of errors from you, and you might spot some weak points of your app as well.

Here’s what we use to have better logging output:

adb logcat | grep `adb shell ps | grep com.package.of.your.app | awk '{print $2}'`

Just to help translate what @krystian6 is showing.   It’s going to take the full stream of output from adb logcat and it’s going to pipe it through a filter.  That filter is going to run a “ps” or process status command on the device and look for the package name of your app.  Once it has that it passes it through another filter to grab just the process ID (I’m guessing here, never ran adb shell ps, but it’s what makes sense) and then using whatever the 2nd field of that is, it limits the ouptut of adb logcat to lines that reference that process.

Very good filtering!!!

Rob

Yeah, I didn’t describe the whole thing

Well the command detects the process id of your application and filters all logs coming from that process.

Which means you will get logs from google ads, and all other plugins which are not coming directly from Corona.

I very often get some errors from external services and I can filter this out this way.

I’ll just add something that might be useful for others.

Limiting logging output only to Corona may hide a lot of errors from you, and you might spot some weak points of your app as well.

Here’s what we use to have better logging output:

adb logcat | grep `adb shell ps | grep com.package.of.your.app | awk '{print $2}'`

Just to help translate what @krystian6 is showing.   It’s going to take the full stream of output from adb logcat and it’s going to pipe it through a filter.  That filter is going to run a “ps” or process status command on the device and look for the package name of your app.  Once it has that it passes it through another filter to grab just the process ID (I’m guessing here, never ran adb shell ps, but it’s what makes sense) and then using whatever the 2nd field of that is, it limits the ouptut of adb logcat to lines that reference that process.

Very good filtering!!!

Rob

Yeah, I didn’t describe the whole thing

Well the command detects the process id of your application and filters all logs coming from that process.

Which means you will get logs from google ads, and all other plugins which are not coming directly from Corona.

I very often get some errors from external services and I can filter this out this way.

I’d like to add to this conversation because I was getting really, really frustrated since my Nexus 6 was not showing up in my list of devices when doing adb devices on my Windows 7 PC.

I had to do three things to make adb work:

  1. Install the Google USB driver from http://developer.android.com/sdk/win-usb.html

  2. Turn on USB Debugging on my Nexus 6 (Settings > About Phone > Tap Build number 7 times)

  3. Turn on Camera (PTP) instead of Media device (MTP) on my Nexus 6 in USB computer connection (Settings > Storage > Menu)

This should probably be added to the Debug Guide: https://docs.coronalabs.com/guide/basics/debugging/index.html

I also suggest expanding the Android section a bit to offer more step-by-step instructions. Rob Miracle, I thought you had done a whole post on it, but I can’t find it now?

Thanks,

Dave

Google certainly does not make getting into developer mode on the devices easy.

Rob

I’d like to add to this conversation because I was getting really, really frustrated since my Nexus 6 was not showing up in my list of devices when doing adb devices on my Windows 7 PC.

I had to do three things to make adb work:

  1. Install the Google USB driver from http://developer.android.com/sdk/win-usb.html

  2. Turn on USB Debugging on my Nexus 6 (Settings > About Phone > Tap Build number 7 times)

  3. Turn on Camera (PTP) instead of Media device (MTP) on my Nexus 6 in USB computer connection (Settings > Storage > Menu)

This should probably be added to the Debug Guide: https://docs.coronalabs.com/guide/basics/debugging/index.html

I also suggest expanding the Android section a bit to offer more step-by-step instructions. Rob Miracle, I thought you had done a whole post on it, but I can’t find it now?

Thanks,

Dave