What's the path [network_security_config.xml] in .aar?

I just Upgrade Unity 2019 → 2021.

AndroidManifest.xml:60: AAPT: error: resource xml/network_security_config (aka com.xxx:xml/network_security_config) not found.

I moved Plugins/Android/Assets and res folder in Empty .aar and put it in plugins/android
(out : res, Assets, in : res.arr)

So I Think I shoud change the path in manifest.

before :

after : ?

My question is, How to I change this?
(xml is folder in res, And other directory like ‘mipmap’ also same)

1 Like

Hi,

I’m having the same issue. Did you found a fix?

Thank you.

No… I’ve just rollback this.

Did anyone find a solution to this? I get a build error after updating to unity 2021 because I have the network_security_config.xml file in Assets/Plugins/Android/res/xml folder which unity doesn’t support anymore.
But if I move it into an aar or android library folder, how do I update the manifest to specify that new location?

Currently I have in the manifest
<application

android:networkSecurityConfig=" @ /network_security_config">

Any update on this guys? I have the same problem

I think you need to have manifest in your aar/library projct with it.

Hey. Thanks for updating on this thread.
I have the manifest , but it still not works

What doesn’t work? The " @ " in the manifest or something else?

The @ in manifest doesn’t work, there is a error message indicates that the “network_security_config.xml” file was not found

Where is the manifest? Inside .androidlib plugin?

inside .AAR. I have packed the res folder into with the created manifest

I’d decompress .aar to check what the manifest inside of it is.
Also, open the built .apk in Android Studio and look what manifest is inside of it.

Hopefully that will give some clue.

I’ve compressed the .aar myself, so I know what is in the manifest.
here is the manifest.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.mycompany.mygame.res">
    <application />
</manifest>

Should I add something else in the Manifest?

I don’t see any network_security_config in this manifest from .aar.

Ah, I see. It’s in the main manifest.
So I should add it to this manifest, right?

So now, I have added the line in the aar’s manifest and removed from the main manifest, but I’m getting the same error.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.mycompany.myapp">
    <application android:networkSecurityConfig="@xml/network_security_config" />
</manifest>

Thanks a lot for you answer, my last problem was because of the manifest file wrong location. It should be outside of the res folder, at the aar root.
Now I am able to build the apk

2 Likes