Android Question app fails in debug mode

fred-han

Member
Licensed User
Hi,
since today, all my apps did not run in "debug mode". In "release mode" everything works fine.
I use B4A V11.00.
The virus scanner "AVG" is disabled.
Even if i try a "new project" with only one button in the main layout, the error occurs.
The error message is always the same for all apps:

B4X:
java.lang.RuntimeException: Unable to create service b4a.example.starter: java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.OutputStream.write(byte[])' on a null object reference
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:3544)
    at android.app.ActivityThread.access$1300(ActivityThread.java:199)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1666)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6669)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.OutputStream.write(byte[])' on a null object reference
    at anywheresoftware.b4a.shell.Shell.virtualAssets(Shell.java:164)
    at anywheresoftware.b4a.shell.Shell.start(Shell.java:102)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:92)
    at b4a.example.starter.onCreate(starter.java:34)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:3532)
    ... 8 more
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.OutputStream.write(byte[])' on a null object reference
    at anywheresoftware.b4a.shell.ShellConnector.sendControlMessage(ShellConnector.java:61)
    at anywheresoftware.b4a.shell.Shell.virtualAssets(Shell.java:124)
    ... 12 more

The app starts and the title is shown for a short moment. After that the screen becomes white and after a while a message with "wait" or "cancel app" appears.

I searched the forum, found some hints (delete windows temp directory - does not work) but there was nothing that helped.

I hope someone knows the reason for this behavior.

Thank in advance

Fred
 

fred-han

Member
Licensed User
I started all devices several times.
Even if i use the device emulator, debug mode fails. I tried to log something in starter sub, but nothing is logged.
The app title is shown shortly on the device, so i think that there is a connection.
 
Upvote 0

fred-han

Member
Licensed User
I also tried it with my mobile. It is always the same. The error message appears, the screen becomes white and after a while the message "wait" or "cancel" appears.
What is the difference between starting in debug mode and release mode. I think that the connection is always the same way?
 
Upvote 0

fred-han

Member
Licensed User
I use it with both modes. Always the same behavior.
This morning i started my computer after a windows update and tried to use debug mode.
AND .....
everything works fine.... First time i started the debug mode for a very simple app, the error messages appear 3 or 4 times in one start, then after 2 oder 3 seconds, the app started normal ....... The next start was without error message.
Debug mode works with emulator and bridge and usb-debug. No more errors.

So i am not enterly satisfied with this solution but i can continue working.

Thanks for your efforts.
 
Upvote 0

fred-han

Member
Licensed User
Hi,
i still have the problem with running my app in debug mode. The error occurs since i installed B4x V.11.0. I never had such a problem before.
Sometimes it works and sometimes not..... That is very frustrating.
I never had such problems with B4A....

Now i found a new variant: if i use the "legacy debugger" and "usb-debugging" on my mobile, the error is gone......

I would agree, that there could be a network problem in debug-mode, but with usb-debugging there is no network (it's serial).

I could live with "legacy debugger". Why is it deprecated?
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
I could live with "legacy debugger". Why is it deprecated?
Because it occupies a lot of memory as every line is compiled with debugging code which takes both memory and slows everything down during execution. The newer debugger actually executes a lot of the non-UI code on the PC rather than on the device and the device runs what is basically just the UI code. If it works for you then use it.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
It is not related to B4A version.

The legacy debugger is much more limited.

Worth monitoring the IDE logs. I've seen cases where the debugger process fails to start because of memory issues.
 
Upvote 0

fred-han

Member
Licensed User
Thanks for your answer.

But actually i see no alternative in using this debugger. The "normal" debugger doesn't work confidently..
And my project is still small.

I am wondering a bit, what is different between B4A 10.xx and 11.0. In all previous versions there was no such problem..
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I am wondering a bit, what is different between B4A 10.xx and 11.0. In all previous versions there was no such problem..
Switch to an old version and test it.
As I wrote several times it is not related to B4A version. You are also the only one who encounters this issue with v11.0.
 
Upvote 0
Top