InterruptedException when targeting Android 8.0 (API level 26)

Smack version 4.3.0

When targeting Android 8.0 (API level 26), it suffers an InterruptedException in connect().

This does not happen when targeting earlier API levels. The same code successfully logs in to server when targeting earlier API levels.

Any idea? Thanks in advance.

09-13 17:27:15.084 11575-12338/io.hetero.communique W/System.err: java.lang.InterruptedException
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2087)
        at org.jivesoftware.smack.SynchronizationPoint.waitForConditionOrTimeout(SynchronizationPoint.java:255)
        at org.jivesoftware.smack.SynchronizationPoint.checkIfSuccessOrWait(SynchronizationPoint.java:153)
09-13 17:27:15.085 11575-12338/io.hetero.communique W/System.err:     at org.jivesoftware.smack.SynchronizationPoint.checkIfSuccessOrWaitOrThrow(SynchronizationPoint.java:128)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection.java:901)
        at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.java:409)
        at io.hetero.communique.service.CommService.loginToServer(CommService.java:134)
        at io.hetero.communique.service.CommService.doNetworkOperations(CommService.java:95)
        at io.hetero.communique.service.CommService.onRunTask(CommService.java:83)
09-13 17:27:15.086 11575-12338/io.hetero.communique W/System.err:     at com.google.android.gms.gcm.GcmTaskService$zze.run(Unknown Source:13)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)

Well something is interrupting the thread. I’ve not read or heard that Android API levels >= 26 cause this, although it could be possible (think for example of background restrictions). But it could also be simply another thread.

Note that you will run into more issues when targeting API levels >= 26. If you need consulting and assistance on how to adopt your app, please have a look at https://github.com/igniterealtime/Smack#professional-services.