Unity-Android packaging error

Table of contents

Error:

analyze:

1. Code removal level setting

2. What methods will be eliminated

3. Solutions


Error:

FileNotFoundException: Could not load file or assembly 'XXX' or one of its dependencies

           at System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, System.Boolean refonly) [0x00016] in <9c7b91d55b9d48c5bd518984f8999ef6>:0 
           at System.AppDomain.Load (System.String assemblyString) [0x00000] in <9c7b91d55b9d48c5bd518984f8999ef6>:0 
           at (wrapper remoting-invoke-with-check) System.AppDomain.Load(string)
           at System.Reflection.Assembly.Load (System.String assemblyString) [0x00005] in <9c7b91d55b9d48c5bd518984f8999ef6>:0 

The reason for the error: After opening the code removal of unity, I removed the dll I used

analyze:

1. Code removal level setting

In playersetting->othersetting->managed stripping level, it is divided into three levels: low, medium and high

Low: Very little code is stripped and has little effect on the package size. This is the default stripping level for unity's il2cpp.
Medium: Balanced between Low and High, i.e. less cautious than Low, and not as extreme as High High
: Prioritizes package size over usability. For usability, use the auxiliary link.xml to artificially reserve the required namespaces or classes in the library. 

2. What methods will be eliminated

Under the culling level of High:

        At present, personal testing, if there is a clear reference to the dll will not be removed 

        dlls that are only used by reflection will be removed

3. Solutions

Create a link.xml file in the project Assets directory and manually add the dlls that do not need to be removed 

how to add

Just add it like this:

<linker>
       <assembly fullname="dll名字">
            <type fullname="*" preserve="all" /> 
       </assembly>
</linker>

Guess you like

Origin blog.csdn.net/SmillCool/article/details/130688863