Search code examples
androidreact-nativewebsocketxmpp

RN Android Release build unable to connect to XMPP server


I have a React Native chat app that connects to an XMPP server hosted on Azure. The app is using websockets for the connection (ws:// not wss://) with the xmpp.js library.

The app can connect when run locally with a Debug build, but fails to connect when using a Release build.

The same app running on iOS connects with no problems locally or when deployed.

I've tried using the debug signing config for release and also creating a release config with a new keystore.


Solution

  • The solution was to allow all network connection types in AndroidManifest.xml

    <application android:usesCleartextTraffic="true">
    </application>
    

    For more details, see the top answer from the following post:

    How to allow all Network connection types HTTP and HTTPS in Android (9) Pie?