Android Programming – Part 13: Cleartext HTTP Traffic Error

Cleartext HTTP Traffic.

REST API is really fun – what is amazing about the code is that you can actually learn not only the coding mechanisms but also the backend sever engineering skills as well.

Hi everyone. Recently, I’ve been updating Road to Google series to improve my coding skill to prepare for any possible future opportunities that may arise. Along with that, I kept myself really busy building my second/third Android portfolios written by Kotlina and Java.

What I’m doing here is building a budget spending tracker app, and I first am building it in Java and will apply it to my other Kotlin app (It’s basically because I’m more familiar with Java than the other way around) with REST API, using LAMP (Linux, Apache, MySQL, and PHP) as the backend server system.

While doing so, I encounter some problems, and I will take notes of how I solved them. And here, I wrote about Cleartext HTTP Traffic Error as shown in image 01.

image 01

How I solved:

It was easy. Just open AndoridManifect.xml and add ‘<uses-permission android:name=”android.permission.INTERNET” />’ and ‘android:usesCleartextTraffic=”true”‘ in the file.

<uses-permission android:name="android.permission.INTERNET" />

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

Happy coding!!

Leave a Reply