Apache Cordova Error (cordova-plugin-whitelist not working): net::ERR_CLEARTEXT_NOT_PERMITTED

This dev tip is brought to you by the developer of MoneyPhone: Personal Expense Tracking for Android and iOS. Consistently spend less than you earn each month and get your finances under control when you start monitoring your expenses with MoneyPhone.

Woah now! What a doozy of an error? What gives?!?! Okay so here’s the low down: cleartext support is disabled by default in Android 9 (API Level 28). So if you are like me and your app was humming along just fine and then one day, boom! Your app quits working. This is probably the issue. Also, if you happen to be following along with the official Apache Cordova quickstart guide or documentation, I could also see running into this problem with little to no guidance regarding what to do.

Luckily, the fix is really simple thanks to a nifty plugin that will make all these awful cleartext problems go away! Navigate to your cordova directory and install cordova-plugin-cleartext:

$ cordova plugin add cordova-plugin-cleartext

$ cordova prepare

$ cordova run android

And that’s all there is to it. Hope this helps, and happy hacking my friend 🙂

 

topherPedersen