Android Question How can you exclude code from debug mode?

NeoTechni

Well-Known Member
Licensed User
Longtime User
I have some blocks of code that are too large for debug mode, as such I haven't ran debug mode in over a year. Is there a way to get debug mode to just skip them without commenting/uncommenting them on demand?

EDIT: I tried commenting out the offending code and got

java.lang.RuntimeException: java.net.SocketException: Socket closed
at anywheresoftware.b4a.shell.Shell.virtualAssets(Shell.java:167)
at anywheresoftware.b4a.shell.Shell.start(Shell.java:99)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:88)
at com.omnicorp.lcarui.test.main.afterFirstLayout(main.java:94)
at com.omnicorp.lcarui.test.main.access$000(main.java:17)
at com.omnicorp.lcarui.test.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.net.SocketException: Socket closed
at libcore.io.Posix.recvfromBytes(Native Method)
at libcore.io.Posix.recvfrom(Posix.java:189)
at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:250)
at libcore.io.IoBridge.recvfrom(IoBridge.java:549)
at java.net.PlainSocketImpl.read(PlainSocketImpl.java:481)
at java.net.PlainSocketImpl.-wrap0(PlainSocketImpl.java)
at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:237)
at java.io.InputStream.read(InputStream.java:162)
at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:149)
at java.io.BufferedInputStream.read(BufferedInputStream.java:295)
at libcore.io.Streams.readFully(Streams.java:81)
at java.io.DataInputStream.readInt(DataInputStream.java:103)
at anywheresoftware.b4a.shell.Shell.virtualAssets(Shell.java:139)
... 12 more
 
Last edited:

NeoTechni

Well-Known Member
Licensed User
Longtime User
B4A version: 5.50
Parsing code. (4.16s)
Compiling code. (9.18s)
Compiling layouts code. (0.00s)
Generating R file. (0.04s)
Compiling debugger engine code. Error
B4A line: 2172
End Sub' http://tosdisplaysproject.wordpress.com/b
javac 1.8.0_45
shell\src\com\omnicorp\lcarui\test\lcarseffects3_subs_0.java:13238: error: code too large for try statement
catch (Exception e) {
^
1 error
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The best solution is to break those subs to several smaller subs. It will fix this issue and will be easier to maintain in the long run.

You can compile some of the modules to a library and then use the library instead of the modules. However this can only work if the modules don't depend on other modules that are not included in the library.
 
Upvote 0
Top