Duplicate Native Method: iOSInit

Hey guys,

For some weird reason when I build for iOS, I keep getting this error thats stopping me from exporting.

 SystemException: Duplicate native method found : IOSInit. Please check your source carefully.
UnityEditor.MonoAOTRegistration.ExtractNativeMethodsFromTypes (ICollection`1 types, System.Collections.ArrayList res) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/MonoInternalCallGenerator.cs:27)
UnityEditor.MonoAOTRegistration.BuildNativeMethodList (Mono.Cecil.AssemblyDefinition[] assemblies) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/MonoInternalCallGenerator.cs:49)
UnityEditor.MonoAOTRegistration.WriteCPlusPlusFileForStaticAOTModuleRegistration (BuildTarget buildTarget, System.String file, CrossCompileOptions crossCompileOptions, Boolean advancedLic, System.String targetDevice, Boolean stripping, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.AssemblyReferenceChecker checker) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/MonoInternalCallGenerator.cs:87)
UnityEditor.iOS.PostProcessiPhonePlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String stagingAreaDataManaged, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) (at /Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/Common/BuildPostProcessor.cs:443)
UnityEditor.iOS.iOSBuildPostprocessor.PostProcess (BuildPostProcessArgs args) (at /Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/Common/ExtensionModule.cs:27)
UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:176)
UnityEditor.HostView:OnGUI()

I can’t figured out what the issue is. I noticed that in two of my classes I had the same methods but with different signatures, but I fixed this and now have only one method with the same name in each class instead of two. I thought that would fix the issue but no luck.

Anyone know how to fix this issue?

Thanks

How many methods are named IOSInit right now ? there could be only 1, according to the error message.

Check you are compiling with il2cpp and not mono. We sometimes get this error if we build with mono.

Had the same issue after I installed the Google Play Games SDK package and FaceBook SDK. Still need to look into which of the two is causing the trouble or if they causing it when installed next to each other. The solution to use il2cpp does indeed work, but has me worried that something may be wrong in the project that will cause other issues later on.