Debugging in Android on Device?

Monkey Targets Forums/Android/Debugging in Android on Device?

Paul - Taiphoz(Posted 2013) [#1]
Sup all..

I have some how introduced a bug which will not activate in html5, flash, or glfw but when I try it on the device it crashes.

anyone know of a good eay to try and get the device to give me some debug info ?, first time iv had a bug that only shows up on the hardware.
:(


Paul - Taiphoz(Posted 2013) [#2]
Tracked it down but still a little confused why its actually crashing..

if some of you could take a peek , think it might be a bug tho.

My initial thought is that Rand is functioning differently on Android ? nah cant be that. or is it that in the New constructor I cant call a method of self because on android its not actually there yet ?

Just seems odd to me that it works on other targets but not android, I suspect its the later but would be cool if any of you know for sure.

..Inside New()
             Self.startframe = Self.GetRandomBadge() '<Either dies here.
..

....
Method GetRandomBadge:Int() '<or here....
    Local BadgeCount:Int = 6
	Local BadgeArray:Int[BadgeCount]
		For Local i:Int = 0 To BadgeCount
			BadgeArray[i] = i * BadgeCount
		Next
		Local selection:Int = 0
		selection = Rand(0, BadgeCount)
		Return BadgeArray[selection]		
End Method



Paul - Taiphoz(Posted 2013) [#3]
OK so nothing wrong with Rand, it's calling a function or method which returns an int inside NEW() seems to kill it.

I am sure this is a bug, I tried changing the method to a function both inside and outside the class and it still fails.

will wait till some one more wise in the ways of the android force has a look before i post it in the bug report section.


AdamRedwoods(Posted 2013) [#4]
depends on what you're doing, but sometimes if you modify values in java's new() it throw concurrency errors.

especially if you use that class in an iterator, java will call a new() to create the iterator. i try to keep my base constructors empty. See if a two-step constructor (new obj, obj.CallMethod) works.


Paul - Taiphoz(Posted 2013) [#5]
I can just hardcode it for the moment but yeah I think that must be whats happening, is it a bug tho seems to me like the code should work and I am sure iv done that before without it throwing a hissy fit.