Android Question Help! java.lang.RuntimeException: Unable to create service

juacochero

Member
Licensed User
Longtime User
Hi everyone!
Sorry to bother you with this, but I'm now getting this error whenever I start my app.
It did not do it yesterday, nothing changed (except I updated to v7.30), and it doesn't do it everytime I run the app (but most times):
Any ideas?
Thank you!


B4X:
java.lang.RuntimeException: Unable to create service cochero.appear.starter:
java.lang.RuntimeException: java.net.SocketException: Socket closed
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2905)
    at android.app.ActivityThread.access$1900(ActivityThread.java:153)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1430)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5451)
    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.lang.RuntimeException: java.net.SocketException: Socket closed
    at anywheresoftware.b4a.shell.Shell.virtualAssets(Shell.java:168)
    at anywheresoftware.b4a.shell.Shell.start(Shell.java:101)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:89)
    at cochero.appear.starter.onCreate(starter.java:33)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2895)
    ... 8 more
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.access$000(PlainSocketImpl.java:37)
    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:140)
    ... 12 more
 

Grant Fullen

Member
Licensed User
Is it possible to hook into a device running the app in debug mode to get more info? Secondly, the crash if involving a SocketException. It's something to do with your Socket connection failing and crashing the app. You may need a try and catch statement somewhere.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Also try move the connectioncode (init, open) to the Service_Start sub.

But the best would be if you create a small test project which shows the issue. Upload this project. File-Export as Zip
 
Upvote 0

Widget

Well-Known Member
Licensed User
Longtime User
Thank you Erel! That seemed to do the trick!

I have this happen a lot with one of my larger apps with the emulator (not a widget) and is very annoying.
You can also solve the problem by reverting to using the legacy debugger (Tools > IDE Options > Use Legacy Debugger) or restart B4A.
 
Upvote 0
Top