Android Question java.net.SocketException: Connection reset - on starting app in Debug mode

Mark Stuart

Active Member
Licensed User
Longtime User
B4X:
Logger connected to:  samsung SM-S916U
--------- beginning of main
java.lang.RuntimeException: Unable to create service com.my_son.scanner.starter: java.lang.RuntimeException: java.net.SocketException: Connection reset
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:5929)
    at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2924)
    at android.os.Handler.dispatchMessage(Handler.java:110)
    at android.os.Looper.loopOnce(Looper.java:273)
    at android.os.Looper.loop(Looper.java:363)
    at android.app.ActivityThread.main(ActivityThread.java:10060)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:632)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
Caused by: java.lang.RuntimeException: java.net.SocketException: Connection reset
    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:105)
    at com.wayward_son.dandy_scandy.starter.onCreate(starter.java:34)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:5916)
    ... 9 more
Caused by: java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:191)
    at java.net.SocketInputStream.read(SocketInputStream.java:143)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:239)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:279)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:338)
    at java.io.DataInputStream.readFully(DataInputStream.java:203)
    at java.io.DataInputStream.readInt(DataInputStream.java:394)
    at anywheresoftware.b4a.shell.Shell.virtualAssets(Shell.java:136)
    ... 13 more
This continually happens when I'm initially starting my development and mostly for the first time Running the app in Debug mode.
I run it again and the app starts up.

This never used to happen during development testing.

Mark Stuart
 

Mark Stuart

Active Member
Licensed User
Longtime User
Hi Erel. Notice it's a Connection Reset, referenced a few times.
So what is getting reset and why?

BTW... I'm testing on 2 devices, not all the time, but now and then.
I notice the reset happens after leaving the computer for a few hours then going back it it to continue my work.
I leave the connection between the IDE and the device "on". I'm in the living room and the computer is in the front room - maybe 20-30 away, and I notice my device has lost its connection.
Could this be the reason for the reset?
Also the connection resets sometimes when I switch devices for testing.
I click on the Clean menu option a couple of times and most of the time that takes care of it.

Mark
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Hard to say.

It might be related to a real network connectivity issue, but it can also happen if something is causing the debugger crash during startup. You can distinguish between the two cases by testing it with a simple project. If it still fails then it is likely to be a network issue or an antivirus that decides to break the network connection.
 
Upvote 1
Top