net maui net 8 uptated networkSecurityConfig not found error ?

Sami 966 Reputation points
2023-11-07T22:48:05.5133333+00:00

net maui net 8 uptated networkSecurityConfig not found error ? how to fix it ?

//AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
	<manifest xmlns:android="http://schemas.android.com/apk/res/android">
		<application android:networkSecurityConfig="@xml/network_security_config" android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
		<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
		<uses-permission android:name="android.permission.INTERNET" />
		<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
	</manifest>


//network-security-config.xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
	<base-config cleartextTrafficPermitted="true" />
	<domain-config cleartextTrafficPermitted="true">
		<domain includeSubdomains="true">example.domain.name</domain>
	</domain-config>
</network-security-config>
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,705 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Derek Baylor 20 Reputation points
    2024-01-22T18:40:59.32+00:00

    I spent several this morning trying to figure out this error and Sami's answer was the only thing that worked. I wanted to add a screenshot for those who don't know where to look.

    1. In your solution right-click on the network_security_config file and select properties. The Properties box will open directly below the solution explorer.
    2. Under the Advanced you'll find Build Action. Just click on that to get the drop-down arrow to appear.
    3. Click on the arrow and select AndroidResource.

    build_action_screenshot

    4 people found this answer helpful.
    0 comments No comments

  2. Sami 966 Reputation points
    2023-11-08T07:22:44.6633333+00:00

    The error was because of network_security_config.xml on solution explorer properties was selected none which has to be androidresource selected.

    3 people found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.