B4J Question When the debugger does not get to AppStart

Heuristx

Active Member
Licensed User
Longtime User
Here is what happened.
Very cleverly, I added this to a code module:

Public Const srvBet As Long = "-"

This is an idiocy, but it happened, no excuse for it.
The problem is, after this, the whole project became undebuggable, that is, it never got to the first line of AppStart. The Log showed Java errors. I'm not sure it makes sense to copy the whole list here, the top of it was

Waiting for debugger to connect...
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)

It was fairly obvious that somehow I wrecked it to such an extent that normally it would not compile.
But at the time I made the mistake, I also added a lot of Resumable Subs, a whole big class, methods, lots of things. I thought some Sub name duplicated a global variable name or something similar happened.
And that was a lot of things to go through. I made a copy of the project, started commenting out what I thought was new or in any way dubious. This took a long time, hours.

I know, I know, I should have tested the project from time to time when I added something relatively little, then it would have been easier to catch mistakes. But what do you expect from someone who assigns a string to a Long constant in Process_Globals?

Now the question:

If something like this happens, the project never gets to any breakpoint, is there way to debug the Java code? Or would I just be reading the generated code and try to debug it in my head? Would that be easier than eliminating the B4X code little by little? Frankly, the error log sounds a bit like Martian to me. I looked into the Java code, too, and it did not look helpful.

Apart from not being an idiot, what is the best way to handle this situation?
 

Heuristx

Active Member
Licensed User
Longtime User
I recreated the problem and ran it in release mode.
Of course, I got Java errors, but the log spelled out a "number format error" and the specific problem clearly. If I had done this, I could have saved a lot of time!
This was a valuable lesson.
 
Upvote 0

johnmie

Active Member
Licensed User
Longtime User
I have exactly the same problem since 2 (working) days, but trying in release mode was even worse:

in Debug I get this message in the log: Rapid Debugger failed to connect to process. Please try to run again.

but in release mode I get this during compilation
B4A Version: 12.50 BETA #1
Parsing code. (0.35s)
Java Version: 14
Building folders structure. (0.12s)
Running custom action. (0.09s)
Compiling code. (0.61s)
Compiling layouts code. (0.08s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Compiling resources (0.07s)
Linking resources (0.48s)
Compiling generated Java code. (3.90s)
Finding libraries that need to be dexed. (0.01s)
Dex code (3.05s)
Dex merge (2.11s)
Copying libraries resources (0.56s)
ZipAlign file. (0.06s)
Signing package file (private key). (0.44s)
Installing file to device. (9.85s)
Device serial: 5203e8a2fc01b317
Completed successfully.


An then the program hangs forever and the logger does not even show a single word.

Just downloaded the latest B4A version 12.5 - no change.

How could I find out which library (if any) caused the problem?

1686563955589.png


Thanks for your help,
john m.
 
Upvote 0
Top