Issue
I've got to add these following line in my AndroidManifest.xml :
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>
I add this in my project_path/config.xml :
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:networkSecurityConfig="@xml/network_security_config" />
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>
</edit-config>
but my AndroidManifest.xml isn't modified when I execute ionic cordova build android
Solution
networkSecurityConfig
isn't loading its config directly from config.xml. It's in an separated XML file.
It is from ressources/android/xml/network_security_config.xml
file (as the line <application android:networkSecurityConfig="@xml/network_security_config" />
state in config.xml)
Put the following in ressources/android/xml/network_security_config.xml:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>
Then run
ionic cordova prepare
Now into platforms/android/app/src/main/res/xml/network_security_config.xml
you will see that your config got updated accordingly.
Answered By - lsmod
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.