Xamarin-android: Add android:networkSecurityConfig support to ApplicationAttribute

Created on 23 Jan 2018  路  6Comments  路  Source: xamarin/xamarin-android

Steps to Reproduce

  1. Add [Application] attribute and try specifying networkSecurityConfig as a property
  2. Compilation fails

Expected Behavior

Should allow user to specify url/path to the networkSecurityConfig

Actual Behavior

Xamarin.Android does not support specifying this attribute in manifest through property.

Version Information

Latest master https://github.com/xamarin/xamarin-android/blob/master/src/Xamarin.Android.NamingCustomAttributes/Android.App/ApplicationAttribute.cs

Log File

N/A

Other

This attribute was included in API 24
https://developer.android.com/guide/topics/manifest/application-element.html#networkSecurityConfig

Looks like it is not yet available via C# surface

App+Library Build enhancement

Most helpful comment

Is there any documentation regarding how to use the attribute? I can see it's publicly available, but when I add it with [Application(NetworkSecurityConfig = "@xml/network_security_config")], the project does not build anymore (error is The "GenerateJavaStubs" task failed unexpectedly).
The network_security_config.xml file is under Resources/xml.

All 6 comments

For future reference, there is nothing related to bindings. It is about MSBuild.

I really need this attribute. When will it be publicly available?

Is there any documentation regarding how to use the attribute? I can see it's publicly available, but when I add it with [Application(NetworkSecurityConfig = "@xml/network_security_config")], the project does not build anymore (error is The "GenerateJavaStubs" task failed unexpectedly).
The network_security_config.xml file is under Resources/xml.

@jonpryor Can you please have a look on my previous comment?

Similar concerns in this issue #2176. There is no apparent workaround to achieve desired results.

For future reference. If you are working on an Android app, make sure after you add the network_security_config.xml file, you configure the Build Action to AndroidResource in the Property panel. This actually fixed the build error "resource xml/network_security_config (aka com.companyname.ut.sample:xml/network_security_config) not found. UT.Sample" for me.

Was this page helpful?
0 / 5 - 0 ratings