CBL sync and Android PIE?

Sync seems to work using the Emulator with Android Studio. However, when I deploy the app to the Android PIE hardware device, I seem to be getting a failure to connect. It would appear that the handheld is “Unauthorized”.

I’ve played with the proxy settings on the handheld, and it if I mis-type the proxy it shows an unknown host type of error. So the proxy server seems to be recognizable. So, for what ever reason, my android app uses a sync that is failing to be authorized to do a sync.

It reminds me somewhat of the sort of behavior I started to see when using Android PIE to access an un-secured server. In that example, I had to change the default for the app to allow such a thing to go forward (namely set android:usesCleartextTraffic to “true” in the AndroidManifest.xml file).

I believe the Sync Gateway is not locked down. Is there a similar setting needed for a socket connection in Android PIE? A sample of the failure to connect run log is below

E/CouchbaseLite/NETWORK: CBLWebSocket.socket_open()
W/CouchbaseLite/NETWORK: WebSocketListener.onFailure() response -> Response{protocol=http/1.0, code=401, message=Unauthorized, url=http://couchbase-gateway.dev.ims-mobile-data.ssaeim.prod.us.walmart.net:4984/common/_blipsync}: java.net.ProtocolException: Expected HTTP 101 response but was ‘401 Unauthorized’
W/CouchbaseLite/NETWORK: {N8litecore4repl12C4SocketImplE#1}==> N8litecore4repl12C4SocketImplE ws://couchbase-gateway.dev.ims-mobile-data.ssaeim.prod.us.walmart.net:4984/common/_blipsync @0x70cbc4e130
{N8litecore4repl12C4SocketImplE#1} WebSocket closed abnormally with status 401
W/CouchbaseLite/NETWORK: C4Socket.dispose() handle -> 484455014976
E/CouchbaseLite/REPLICATOR: {Repl#2}==> N8litecore4repl10ReplicatorE /data/user/0/com.walmart.ims.puddle/files/common.cblite2/ ->ws://couchbase-gateway.dev.ims-mobile-data.ssaeim.prod.us.walmart.net:4984/common/_blipsync @0x70b8537dc8
E/CouchbaseLite/REPLICATOR: {Repl#2} Got LiteCore error: WebSocket error 401 “Unauthorized”
W/CouchbaseLite/NETWORK: C4Socket.open() socket -> 484425436608
C4Socket.open() clazz -> com.couchbase.lite.internal.replicator.CBLWebSocket
E/CouchbaseLite/NETWORK: CBLWebSocket.socket_open()
W/CouchbaseLite/NETWORK: WebSocketListener.onFailure() response -> Response{protocol=http/1.0, code=502, message=Bad Gateway, url=http://couchbase-gateway.dev.ims-mobile-data.ssaeim.prod.us.walmart.net:4984/salesfloor/_blipsync}: java.net.ProtocolException: Expected HTTP 101 response but was ‘502 Bad Gateway’
W/CouchbaseLite/NETWORK: {N8litecore4repl12C4SocketImplE#3}==> N8litecore4repl12C4SocketImplE ws://couchbase-gateway.dev.ims-mobile-data.ssaeim.prod.us.walmart.net:4984/salesfloor/_blipsync @0x70ca018cb0
{N8litecore4repl12C4SocketImplE#3} WebSocket closed abnormally with status 502

I suspect the problem that is documented here: https://docs.couchbase.com/couchbase-lite/current/java.html#starting-a-replication

Scroll down to the Note and follow the link.