android - java.net.UnknownServiceException: CLEARTEXT communication to 10.0.2.2 not permitted by network security policy
Bump into this error when trying to initate a service request to
java.net.UnknownServiceException: CLEARTEXT communication to 10.0.2.2 not permitted by network security policy
2026-05-05 20:57:52.706 8867-8867 System.err com.appcoreopc.getmyhome W at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:188)
2026-05-05 20:57:52.706 8867-8867 System.err com.appcoreopc.getmyhome W at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
2026-05-05 20:57:52.706 8867-8867 System.err com.appcoreopc.getmyhome W at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
2026-05-05 20:57:52.706 8867-8867 System.err com.appcoreopc.getmyhome W at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
2026-05-05 20:57:52.706 8867-8867 System.err com.appcoreopc.getmyhome W at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
To resolve it, we need to add
app\src\main\res\xml\network_security_config.xml
Comments