janishar / android-mvvm-architecture

This repository contains a detailed sample app that implements MVVM architecture using Dagger2, Room, RxJava2, FastAndroidNetworking and PlaceholderView
https://janisharali.com
Apache License 2.0
2.95k stars 936 forks source link

Allow cleartext communication with mocky.io #42

Closed vy8 closed 5 years ago

vy8 commented 5 years ago

Changing targetSdkVersion to 28 has introduced a side effect where clear text communication is no longer allowed. When I run the app with a 28 emulator I get an error <-- HTTP FAILED: java.net.UnknownServiceException: CLEARTEXT communication to www.mocky.io not permitted by network security policy

The easy solution would be to change the http://www.mocky.io/v2 endpoint to https. However their SSL configuration is bad and SSL requests to mocky.io get bounced. They have an issue regarding this here: https://github.com/julien-lafont/Mocky/issues/35 Also it is evident when scanning them with this tool: https://www.sslshopper.com/ssl-checker.html#hostname=https://www.mocky.io/

This PR allows cleartext communication on 28 as described in this SO answer: https://stackoverflow.com/a/50834600/1803821