Program works under simulator but not on the phone

Have anyone experience the problem whereby your program tested fine on the simulator/debugger. But once you package the program (I have a HTC Desire HD Android phone) and install on the phone, it doesn’t work.

How do you solve the problem? I thought of putting down ‘print’ statements, but where does the printed statement goes on the phone?

Any help would be appreciated.

Regards. [import]uid: 93204 topic_id: 19228 reply_id: 319228[/import]

I don’t know about android, but on iOS devices, they can be tethered to your mac and Xcode and display device logs where you can see your print statements. They have heavilly buffered so its hard to get real time results, though I did see some code that turned off the buffering to make it a little more real time. Maybe the Android SDK has a siimilar feature.

As for why? Well there are quite a few reasons why it wouldn’t run and its a real pain to find out why.

Sorry I can’t be of much help. [import]uid: 19626 topic_id: 19228 reply_id: 74205[/import]

THank you. It appears xcode is for iOS. Anyone out there could tell me the equivalent for Android? I never heard of tethered to your PC to display device log. I would had thought I could view the device log from the phone itself. [import]uid: 93204 topic_id: 19228 reply_id: 74252[/import]

Hey,

I don’t actually work much with Android (at all) but I believe the program you are looking for is called “adb logcat”.

For your problem with device does it install or do you get an error? Is it just a black screen?

Peach :slight_smile: [import]uid: 52491 topic_id: 19228 reply_id: 74349[/import]

Thanks Peach. Yes, I am now looking at ADB and trying to install it.

For my problem, the apk file installs successfully and the program initiates no problems. The screen is as expected, but when I press on a button, the app does nothing. I know the button had been pressed successfully as the button blinks when touched.

When I run the app under Corona Debugger on my PC, everything works as expected.

I hope the ADB will help me.

Regards. [import]uid: 93204 topic_id: 19228 reply_id: 74361[/import]

Hi All,

Found the problem!

Firstly, installed ADB on my development PC and USB Tethered with my HTC Desire HD. Ran ‘adb logcat’ on my PC Command Prompt (as Peach suggested) and tested my app.

The problem was that my code was trying to compare a number variable with a text (which happens to have a number value). Used ‘tonumber’ to convert the text to number and all worked.

I am not sure why under the Corona Debugger, this error was not detected and it executed everything successfully. There could be a ‘bug’ in the Debugger.

Anyway, a big thank you to everyone who had contributed. I now have learned something about adb.

Kind Regards. [import]uid: 93204 topic_id: 19228 reply_id: 74366[/import]

Hey there,

Thrilled to hear it is all resolved :slight_smile:

For the issue - you didn’t get any warnings on device? I believe when trying to compare a number to text you should get a “attempt to compare to string” error.

You’re only using a PC, correct? (If so I will look at this myself tomorrow - it may be the error appears on Mac but not PC.)

Peach :slight_smile: [import]uid: 52491 topic_id: 19228 reply_id: 74374[/import]

I thought Lua was supposed to be typeless language when it comes to numbers and strings like PHP, JavaScript and Perl.

Hmmm. Wonder if this is the cause of some of my oddities?
[import]uid: 19626 topic_id: 19228 reply_id: 74403[/import]

Hi Peach. Yes, I am using a PC. I only saw the warning through ‘adb logcat’.

If I use the app on the device (ie. no adb) or through the Corona Debugger. There was no such warning. I was unable to use the app through the Corona Simulator because there is no support for text input field (yes, I am using text input because there is no class in Corona with a date picker that look like Android UI - CoronaUI look like its for iOS. But this is a different matter).

I also thought the fields should be typeless and lua was support to automatically convert. [import]uid: 93204 topic_id: 19228 reply_id: 74432[/import]

The simulator does support text input - what version are you using? 704 supports text input and is the latest stable :slight_smile: [import]uid: 52491 topic_id: 19228 reply_id: 74476[/import]

Thanks Peach. I do have the latest build 704. The input text still don’t work on the simulator. I had to use a class call ‘rum’, which only show the text box but can’t enter text. [import]uid: 93204 topic_id: 19228 reply_id: 74536[/import]

I know Rum, it’s Graham Ranson’s work. (He’s behind Lime and Ice as well. He’s going for a Cuba Libre ;)).

Apologies RE the simulator confusion, I haven’t used Corona on Windows in a long time and misread the build notes.

Peach :slight_smile: [import]uid: 52491 topic_id: 19228 reply_id: 74612[/import]