How to modify build.settings

Hi,
I have to add to build.settings the following line

    android:usesCleartextTraffic="true"

But I don’t know if I did well:

--
-- Android section
--
android =
{
	googlePlayGamesAppId = "874231189156",
	usesPermissions =
	{
		"android.permission.INTERNET",
		"com.android.vending.CHECK_LICENSE"

	},

	applicationChildElements =
	{
		[[
			<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-7458926770415601~7831222224"/>
    <android:usesCleartextTraffic="true" />
		]],
	}
},

Besides I used a buid.settings I found in a tutorial, so I don’t understand if I need the lines:

android:value="ca-app-pub-7458926770415601~7831222224"

and

googlePlayGamesAppId = "874231189156"

That should go in your AndroidResources/res/xml/network_security_config.xml file

1 Like

@colinmorgan thanks. I thought that the build.settings will create the xml!
Should I include the “https://” to the domain name?

If you’re going to use https:// instead of http://, then you don’t need to have a clearText carve out in your network_security_config.xml. (In fact, you probably don’t need a network_security_config.xml file at all.)

If you are asking about the syntax inside of cleartextTrafficPermitted="true", I recommend formatting it just like the example.

1 Like

@colinmorgan Thanks. Everything is ok, now.

@colinmorgan

How did you manage to set that cleartext parameter ?
I tried different methods without success

Thanks

@rodymary this is my network_security_config.xml

<?xml version="1.0" encoding="utf-8"?> 
<network-security-config> 
<domain-config cleartextTrafficPermitted="true"> 
<domain includeSubdomains="true">https://domain.xx/</domain> 
</domain-config> 
</network-security-config>

It works for me.

I decided to try just switching all my http:// calls to https:// to see if I could save myself the hassle of setting up and keeping track of network_security_config.xml files, and everything worked fine, so I never actually ended up implementing cleartextTrafficPermitted.

1 Like

@colinmorgan Your right. I left it only because of laziness!

1 Like

Thanks Saleh & colinmorgan, but you’re using httpS, not me …

I tryed everything without success (Android 10 inside).

Could someone show me how to set up build.settings and network_security_config.xml ,
I’m trying to locally access that url : http://192.168.1.30/test

Thanks for your help

Finally I found out how to access not secured local ressources (HTTP instead of HTTPS) on Android > 8
The difficulty for me was to find where I had to create the network_security_config.xml file, it must be in the …myProject\AndroidResources\res\xml folder
With that simple content :

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true" />
</network-security-config>

And that’s it. Hope that can help someone else
Rod

3 Likes