Android Question MySocket.Connect Crash

Kurt.McCullum

Member
Licensed User
I've been searching the message board for a solution to this but I have not found one yet.

I have a program that works perfectly in debug mode but when I compile the application and try to run it on the exact same device, it crashes when it hits MySocket.Connect.

I'm sure there is an easy solution but I'm stuck.

Kurt
 

Kurt.McCullum

Member
Licensed User
You need to check the logs (requires USB debug mode as it is in release mode) and post the error message.
There in lies the problem. I am using the USB port of the phone to attach to a serial device. So USB debug isn't possible. I'll see if I can do this through Bluetooth, thus freeing up the port.

Kurt
 
Upvote 0

fixit30

Active Member
Licensed User
Longtime User
You could try catching the exception in the Starter Service and writing the exception to a text file on the device.
 
Upvote 0

Kurt.McCullum

Member
Licensed User
You need to check the logs (requires USB debug mode as it is in release mode) and post the error message.
Here is the log when I use USB debugging.
-----------------------------------------------
** Activity (main) Resume **
PackageAdded: package:mComm.A
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Service (modemservice) Create **
** Service (modemservice) Start **
modemservice_tmrnet_tick (java line: 750)
android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1161)
at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:249)
at libcore.io.IoBridge.recvfrom(IoBridge.java:553)
at java.net.PlainSocketImpl.read(PlainSocketImpl.java:485)
at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:37)
at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:237)
at anywheresoftware.b4a.objects.streams.File$InputStreamWrapper.ReadBytes(File.java:406)
at mComm.A.modemservice._tmrnet_tick(modemservice.java:750)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…