Android Question b4a debug / rapid_debug / release version

vangogh

Active Member
Licensed User
Longtime User
I am refurbishing my old b4a app written on b4a v2.71 (paid version), it has been working till android 12, now it closes immediately on android 13
it's an app I use in a warehouse, it's not sold or distributed on play store

I used to install the "result_debug.apk" because so I could trap the errors - I can read the line number and the statement, veeeeery useful ! I get NO overhead issues on my app
my result_debug, on b4a v2.71 was about 11MEG

Now, using b4a v12.50, I get a RESULT_RAPID_DEBUG.apk tha is REALLY small (162kb), it works on my developing device "managed" by the b4a IDE, but I don't know if it's "everything", and I can distribute it "as it is: only 261kb

.... before doing a disaster, i prefer to ask:

Can I install the (very small 162kb) RESULT_RAPID_DEBUG.apk as I did with v2.71 (big 11meg) RESULT_DEBUG. apk?

... also on very old and new devices, as my andoind v6 and v13?

THANK YOU

was: b4a v2.71
now: b4a v12.50 64bit
 
Last edited:

agraham

Expert
Licensed User
Longtime User
No you can't distribute RESULT_RAPID_DEBUG.apk. It is a stub application that handles the UI on the device, the app code is actually running on the PC during rapid debugging. Selecting 'Use Legacy Debugging' in Tools -> IDE Options will give you the old behaviour but you really shouldn't be distributing that as it includes a lot of overhead code to support debugging that degrades the performance of the app on the device.
 
Upvote 0

vangogh

Active Member
Licensed User
Longtime User
YEP!

so, if I really want to have debugging mode in my app, as I have now (without niticeable as on old devices),
-as it is VERY useful to me tro trap and fix errors -
I should

- ENABLE the tools / option / use legacy debugger flag
- compile in DEBUG MODE
- use the RESULT_DEBUG.apk

right?

BTW: this way the result_debug I get is 1.3MEG. still veeeeery small - it was 11MEG

THANK YOU!!!

No you can't distribute RESULT_RAPID_DEBUG.apk. It is a stub application that handles the UI on the device, the app code is actually running on the PC during rapid debugging. Selecting 'Use Legacy Debugging' in Tools -> IDE Options will give you the old behaviour but you really shouldn't be distributing that as it includes a lot of overhead code to support debugging that degrades the performance of the app on the device.
 
Upvote 0

vangogh

Active Member
Licensed User
Longtime User
this is clear, now, thank you AGraham.

what is not clear to me (I am sorry) is

Can I add the "debugging code" I had in older b4a versions that did this: when I got an error, the app itself showed me the entire row that raised the error and the line number.
even if not connected with the IDE. belive, VERY useful.
"hey programmer, i got an error in this line, this is the screenshot" - very easy to understand and fix.

Will the app do this if I set the "use legacy debugger" and compile in "release" mode?
 
Upvote 0

vangogh

Active Member
Licensed User
Longtime User
I'm afraid that I don't know what you mean by"debugging code" so I don't know how your app did this.

in my old b4a app, written with b4a 2.71, when an error arise, I see the complete code line (in b4a, as it was originally written in the B4A editor!) and the line number

eg I see this IN MY APP, running standalone, disconnected from the b4a IDE:

---> error line 1234: a = a + b , error B is not numeric

(it's only an example! )

absolutely useful!
 
Upvote 0

vangogh

Active Member
Licensed User
Longtime User
Do you mean displaying the log output?
no.

take this code

1 a = 1
2 b = 0
3 c = a / b : label1.text=c

compile it, run it on the Android device

the screen of your device will show (on b4a v 2.71) something like

"
division by zero error
line 3: c = a / b : label1.text=c
"

so il shows
- the line number of the sentence that goes in error
- the whole sentence
- the error

can you guess how useful it is - it was?
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
no.

take this code

1 a = 1
2 b = 0
3 c = a / b : label1.text=c

compile it, run it on the Android device

the screen of your device will show (on b4a v 2.71) something like

"
division by zero error
line 3: c = a / b : label1.text=c
"

so il shows
- the line number of the sentence that goes in error
- the whole sentence
- the error

can you guess how useful it is - it was?
I must admit I don't understand what you are saying.

I just created a default b4xpages app and added your code.

B4X:
'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip

Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
End Sub

Public Sub Initialize
'    B4XPages.GetManager.LogEvents = True
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
End Sub

'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.

Private Sub Button1_Click
    Private a,b,c As Double
    a = 6
    b = 0
    
    c = a/b
    
    xui.MsgboxAsync($"Hello world! The answer is ${c}"$, "B4X")
End Sub

The output on my phone is "Infinity."

However, If I change the code to produce an error. I see the error in the log and the error is on the exact line number which has the problem.

1696799662855.png
 

Attachments

  • divzero.zip
    13.9 KB · Views: 36
Upvote 0

vangogh

Active Member
Licensed User
Longtime User
cool, but when the error is on the remote user's device, I cannot read the log easily

look the image.
My programming error was to set an array dimension of 2000, tnah I got 2001 data

this is the user's remote screen when he get the error.
He send this screenshot to me, I understood everything, exactly, and fixed it in a second
SOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO useful
 

Attachments

  • WhatsApp Image 2023-10-13 at 08.57.55.jpeg
    WhatsApp Image 2023-10-13 at 08.57.55.jpeg
    151.4 KB · Views: 41
Upvote 0
Top