- Home /
How do I include added dll's to a android apk build?
Hi currently im referencing an external dll and import it using [DllImport("dll_name_here")] nut this doesn;t seem to work with android, do I need to place this in a certain folder or does it need to be in a different format? Sorry this is probably a wierd question but im quite confused about dlls and such!
Answer by jilleJr · Apr 18, 2019 at 11:33 AM
If it doesn't find the DLL then it could be because it is being stripped. Try specifying it in a link.xml linker file to force it being included.
Example:
<linker>
<assembly fullname="AssemblyNameOfDLLYouWantIncluded" preserve="all"/>
</linker>
The "fullname" attribute is in most cases the same value as the name of the DLL file (without extension).
Save that to file link.dll
. It can be placed anywhere, or rather, more specifically, as quoted from the manual:
"/.../ creating a link.xml file and placing it into the Assets folder (or any subdirectory of Assets)."
Ref: https://docs.unity3d.com/Manual/IL2CPP-BytecodeStripping.html