particle-iot / spark-setup-android

Former home of the Particle Device Setup library for Android
Apache License 2.0
23 stars 30 forks source link

Failing to bind Socket connection #67

Closed ghostship closed 5 years ago

ghostship commented 5 years ago

Updated device setup from 0.4.6 -> 0.6.1 Now getting an error during during device discovery.

Seems to be Samsung device specific. Tested on multiple API levels and can't bind to socket. Seems to work on the nexus devices tested (APIs 21-28)

Connect to device -> choose soft AP -> throws:

11-02 13:53:13.761 14493-14902/<appid> I/CommandClient: Preparing to send command 'device-id'
11-02 13:53:13.781 14493-14902/<appid> I/CommandClient: *** BUILT COMMAND DATA: 'device-id\n0\n\n'
11-02 13:58:33.811 14493-14902/<appid> D/EZ: Can't close closable, arg was null.
11-02 13:58:33.821 14493-14902/<appid> D/DiscoverDeviceActivity: Setup exception thrown: 
    io.particle.android.sdk.devicesetup.setupsteps.SetupStepException: Process died while trying to get the device ID
        at io.particle.android.sdk.devicesetup.ui.DiscoverProcessWorker.doTheThing(DiscoverProcessWorker.java:54)
        at io.particle.android.sdk.devicesetup.ui.DiscoverDeviceActivity$1.doInBackground(DiscoverDeviceActivity.java:334)
        at io.particle.android.sdk.devicesetup.ui.DiscoverDeviceActivity$1.doInBackground(DiscoverDeviceActivity.java:324)
        at android.os.AsyncTask$2.call(AsyncTask.java:292)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
        at java.lang.Thread.run(Thread.java:818)
     Caused by: java.net.SocketException: Binding socket to network 501 failed: errno 64 (Machine is not on the network)
        at android.net.Network.bindSocketFd(Network.java:337)
        at android.net.Network.bindSocket(Network.java:330)
        at io.particle.android.sdk.devicesetup.commands.NetworkBindingSocketFactory.bindSocketToSoftAp(NetworkBindingSocketFactory.java:93)
        at io.particle.android.sdk.devicesetup.commands.NetworkBindingSocketFactory.buildSocket(NetworkBindingSocketFactory.java:77)
        at io.particle.android.sdk.devicesetup.commands.NetworkBindingSocketFactory.createSocket(NetworkBindingSocketFactory.java:45)
        at io.particle.android.sdk.devicesetup.commands.CommandClient.sendAndMaybeReceive(CommandClient.java:55)
        at io.particle.android.sdk.devicesetup.commands.CommandClient.sendCommand(CommandClient.java:44)
        at io.particle.android.sdk.devicesetup.ui.DiscoverProcessWorker.doTheThing(DiscoverProcessWorker.java:48)
        at io.particle.android.sdk.devicesetup.ui.DiscoverDeviceActivity$1.doInBackground(DiscoverDeviceActivity.java:334) 
        at io.particle.android.sdk.devicesetup.ui.DiscoverDeviceActivity$1.doInBackground(DiscoverDeviceActivity.java:324) 
        at android.os.AsyncTask$2.call(AsyncTask.java:292) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
        at java.lang.Thread.run(Thread.java:818) 
     Caused by: android.system.ErrnoException: Binding socket to network 501 failed: errno 64 (Machine is not on the network)
        at android.net.Network.bindSocketFd(Network.java:337) 
        at android.net.Network.bindSocket(Network.java:330) 
        at io.particle.android.sdk.devicesetup.commands.NetworkBindingSocketFactory.bindSocketToSoftAp(NetworkBindingSocketFactory.java:93) 
        at io.particle.android.sdk.devicesetup.commands.NetworkBindingSocketFactory.buildSocket(NetworkBindingSocketFactory.java:77) 
        at io.particle.android.sdk.devicesetup.commands.NetworkBindingSocketFactory.createSocket(NetworkBindingSocketFactory.java:45) 
        at io.particle.android.sdk.devicesetup.commands.CommandClient.sendAndMaybeReceive(CommandClient.java:55) 
        at io.particle.android.sdk.devicesetup.commands.CommandClient.sendCommand(CommandClient.java:44) 
        at io.particle.android.sdk.devicesetup.ui.DiscoverProcessWorker.doTheThing(DiscoverProcessWorker.java:48) 
        at io.particle.android.sdk.devicesetup.ui.DiscoverDeviceActivity$1.doInBackground(DiscoverDeviceActivity.java:334) 
        at io.particle.android.sdk.devicesetup.ui.DiscoverDeviceActivity$1.doInBackground(DiscoverDeviceActivity.java:324) 
        at android.os.AsyncTask$2.call(AsyncTask.java:292) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
        at java.lang.Thread.run(Thread.java:818)

Problem seems to be coming from the NetworkBindingSocketFactory?

jensck commented 5 years ago

v0.6.2 of the device setup library has been released, which contains the fix for this