2

I'm developing an app with IONIC 4.0 (Angular). The app is completely okay while I am running the APK file in android Orio (8.0). But unfortunately, it shows the following problem when I am getting to log in Android PIE (9.0). enter image description here

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
Abhijit Mondal Abhi
  • 1,364
  • 4
  • 15
  • 34

3 Answers3

3

I had the same problem with Android 9, it was confused but with a little research, I found new features about the new Android version, here you'll found the solution:

SOLUTION

According to Network security configuration

Option 1 -

Create file res/xml/network_security_config.xml - `

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">Your URL(ex: 127.0.0.1)</domain>
    </domain-config>
</network-security-config>

`

On your AndroidManifest.xml -

<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        ...
        android:networkSecurityConfig="@xml/network_security_config"
        ...>
        ...
    </application>
</manifest>

Option 2 -

android:usesCleartextTraffic Doc

On your AndroidManifest.xml -

<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        ...
        android:usesCleartextTraffic="true"
        ...>
        ...
    </application>
</manifest>

Its works perfectly for me :)

Marco Chavez
  • 365
  • 2
  • 7
0

open your config.xml file

Add this line to Widget tag

xmlns:android="http://schemas.android.com/apk/res/android"

under the platform android section add the below line

<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:usesCleartextTraffic="true" />
</edit-config>

This is worked for me.

mahendra
  • 1
  • 2
-1

That's happens because since Android Pie, you cannot make non secure http requests. There's some what's to workaround it, but I've found no one that works on Ionic/Cordova.

That's a pain, but you will need to add a self signed ask cert to your Api server, add it to trust store on Android and with luck it will work.

I'm writing from mobile now, but as soon as possible I'll update my answer to add some references.

Elias Soares
  • 9,884
  • 4
  • 29
  • 59