antoniolg/Kotlin-for-Android-Developers

Change http links to https-- Android error

Closed this issue ยท 3 comments

In MainActivity.kt, starting with Chapter 8, the http link gives me this error in MainActivity->onCreate:

weatherapp W/System.err: java.io.IOException: Cleartext HTTP traffic to api.openweathermap.org not permitted

I propose changing the http://api.openweather... URL to https://api.openweather...

if not, please update manifest.

<manifest ...>

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

According to Network security configuration: "Starting with Android 9.0 (API level 28), cleartext support is disabled by default."

@SVNicolaeDaniel suggestion works. Can also look at the following for more options: https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted

In MainActivity.kt, starting with Chapter 8, the http link gives me this error in MainActivity->onCreate:

weatherapp W/System.err: java.io.IOException: Cleartext HTTP traffic to api.openweathermap.org not permitted

I propose changing the http://api.openweather... URL to https://api.openweather...

this solved the problem