IL2CPP Android Build Failure 5.5.0p3

Error trying to build for Android using IL2CPP:

Failed running C:\Program Files\Unity\Editor\Data\il2cpp/build/il2cpp.exe --convert-to-cpp --emit-null-checks --enable-array-bounds-check --compile-cpp --libil2cpp-static --platform=“Android” --architecture=“ARMv7” --configuration=“Release” --outputpath=“D:_Projects\LOA_5.5_Android\Temp/StagingArea\assets\bin\Data\Native\armeabi-v7a\libil2cpp.so” --cachedirectory=“D:_Projects\LOA_5.5_Android\Assets..\Library\il2cpp_android_armeabi-v7a/il2cpp_cache” --additional-include-directories=“C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\bdwgc/include” --additional-include-directories=“C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\libil2cpp/include” --tool-chain-path=“C:/Users/Danish/AppData/Local/Android/android-ndk-r10e” --map-file-parser=“C:\Program Files\Unity\Editor\Data\Tools\MapFileParser\MapFileParser.exe” --extra-types.file=“C:\Program Files\Unity\Editor\Data\il2cpp\il2cpp_default_extra_types.txt” --assembly=“D:_Projects\LOA_5.5_Android\Temp\StagingArea\assets\bin\Data\Managed\Assembly-CSharp-firstpass.dll” --assembly=“D:_Projects\LOA_5.5_Android\Temp\StagingArea\assets\bin\Data\Managed\Assembly-CSharp.dll” --assembly=“D:_Projects\LOA_5.5_Android\Temp\StagingArea\assets\bin\Data\Managed\Assembly-UnityScript-firstpass.dll” --assembly=“D:_Projects\LOA_5.5_Android\Temp\StagingArea\assets\bin\Data\Managed\Assembly-UnityScript.dll” --assembly=“D:_Projects\LOA_5.5_Android\Temp\StagingArea\assets\bin\Data\Managed\UnityEngine.UI.dll” --assembly=“D:_Projects\LOA_5.5_Android\Temp\StagingArea\assets\bin\Data\Managed\UnityEngine.dll” --assembly=“D:_Projects\LOA_5.5_Android\Temp\StagingArea\assets\bin\Data\Managed\System.dll” --generatedcppdir=“D:_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput”

stdout:
Building libil2cpp.so with AndroidToolChain.
Output directory: D:_Projects\LOA_5.5_Android\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a
Cache directory: D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache
ObjectFiles: 524 of which compiled: 524
Time Compile: 160308 milliseconds Il2CppAttributes.cpp
Time Compile: 64838 milliseconds Bulk_mscorlib_6.cpp
Time Compile: 62718 milliseconds Bulk_Generics_10.cpp
Time Compile: 55489 milliseconds Il2CppInvokerTable.cpp
Time Compile: 46689 milliseconds Bulk_Assembly-CSharp-firstpass_8.cpp
Time Compile: 44726 milliseconds Bulk_Assembly-CSharp_14.cpp
Time Compile: 44320 milliseconds Bulk_Assembly-CSharp-firstpass_2.cpp
Time Compile: 42251 milliseconds Bulk_mscorlib_1.cpp
Time Compile: 42226 milliseconds Bulk_Generics_11.cpp
Time Compile: 41717 milliseconds GenericMethods0.cpp
Total compilation time: 542985 milliseconds.
il2cpp.exe didn’t catch exception: Unity.IL2CPP.Building.BuilderFailedException: C:\Users\Danish\AppData\Local\Android\android-ndk-r10e oolchains\llvm-3.6\prebuilt\windows-x86_64\bin\clang++ @“C:\Users\Danish\AppData\Local\Temp mp50E5.tmp” -o “D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_EA45E5BD420B2E309B8153EB2D6B0D8C\libil2cpp.so” -Wl,-soname,libil2cpp.so -shared -Wl,–no-undefined -Wl,-z,noexecstack -Wl,–gc-sections -Wl,–build-id --sysroot “C:\Users\Danish\AppData\Local\Android\android-ndk-r10e\platforms\android-9\arch-arm” -gcc-toolchain “C:\Users\Danish\AppData\Local\Android\android-ndk-r10e oolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64” -target armv7-none-linux-androideabi -L “C:\Users\Danish\AppData\Local\Android\android-ndk-r10e\sources\cxx-stl\gnu-libstdc++\4.9\libs\armeabi-v7a” -lgnustl_static -Xlinker -Map=“D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_EA45E5BD420B2E309B8153EB2D6B0D8C\libil2cpp.map” -fuse-ld=bfd

D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_ShowRateUsPopUp_m1614004314': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:43872: undefined reference to _MNP_ShowRateUsPopUp’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_ShowDialog_m139050292': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:43918: undefined reference to _MNP_ShowDialog’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_ShowMessage_m1339889631': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:43956: undefined reference to _MNP_ShowMessage’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_DismissCurrentAlert_m1417265054': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:43978: undefined reference to _MNP_DismissCurrentAlert’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_RedirectToAppStoreRatingPage_m1780619814': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:43992: undefined reference to _MNP_RedirectToAppStoreRatingPage’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_ShowPreloader_m3117138150': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:44006: undefined reference to _MNP_ShowPreloader’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_HidePreloader_m2701373143': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:44016: undefined reference to _MNP_HidePreloader’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_DismissCurrentAlert_m1417265054': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:43978: undefined reference to _MNP_DismissCurrentAlert’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_RedirectToAppStoreRatingPage_m1780619814': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:43992: undefined reference to _MNP_RedirectToAppStoreRatingPage’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_ShowPreloader_m3117138150': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:44006: undefined reference to _MNP_ShowPreloader’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_HidePreloader_m2701373143': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:44016: undefined reference to _MNP_HidePreloader’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_RedirectToAppStoreRatingPage_m1780619814': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:43992: undefined reference to _MNP_RedirectToAppStoreRatingPage’
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)

at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(IEnumerable`1 objectFiles, CppToolChainContext toolChainContext)
at Unity.IL2CPP.Building.CppProgramBuilder.Build()
at il2cpp.Program.DoRun(String args)
at il2cpp.Program.Run(String args)
at il2cpp.Program.Main(String args)
stderr:

Unhandled Exception: Unity.IL2CPP.Building.BuilderFailedException: C:\Users\Danish\AppData\Local\Android\android-ndk-r10e oolchains\llvm-3.6\prebuilt\windows-x86_64\bin\clang++ @“C:\Users\Danish\AppData\Local\Temp mp50E5.tmp” -o “D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_EA45E5BD420B2E309B8153EB2D6B0D8C\libil2cpp.so” -Wl,-soname,libil2cpp.so -shared -Wl,–no-undefined -Wl,-z,noexecstack -Wl,–gc-sections -Wl,–build-id --sysroot “C:\Users\Danish\AppData\Local\Android\android-ndk-r10e\platforms\android-9\arch-arm” -gcc-toolchain “C:\Users\Danish\AppData\Local\Android\android-ndk-r10e oolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64” -target armv7-none-linux-androideabi -L “C:\Users\Danish\AppData\Local\Android\android-ndk-r10e\sources\cxx-stl\gnu-libstdc++\4.9\libs\armeabi-v7a” -lgnustl_static -Xlinker -Map=“D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_EA45E5BD420B2E309B8153EB2D6B0D8C\libil2cpp.map” -fuse-ld=bfd

D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_ShowRateUsPopUp_m1614004314': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:43872: undefined reference to _MNP_ShowRateUsPopUp’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_ShowDialog_m139050292': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:43918: undefined reference to _MNP_ShowDialog’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_ShowMessage_m1339889631': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:43956: undefined reference to _MNP_ShowMessage’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_DismissCurrentAlert_m1417265054': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:43978: undefined reference to _MNP_DismissCurrentAlert’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_RedirectToAppStoreRatingPage_m1780619814': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:43992: undefined reference to _MNP_RedirectToAppStoreRatingPage’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_ShowPreloader_m3117138150': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:44006: undefined reference to _MNP_ShowPreloader’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_HidePreloader_m2701373143': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:44016: undefined reference to _MNP_HidePreloader’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_DismissCurrentAlert_m1417265054': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:43978: undefined reference to _MNP_DismissCurrentAlert’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_RedirectToAppStoreRatingPage_m1780619814': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:43992: undefined reference to _MNP_RedirectToAppStoreRatingPage’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_ShowPreloader_m3117138150': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:44006: undefined reference to _MNP_ShowPreloader’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_HidePreloader_m2701373143': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:44016: undefined reference to _MNP_HidePreloader’
D:_Projects\LOA_5.5_Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\C462C7F4A0EF2E0D18A380D42FAA6A72.o: In function MNIOSNative__MNP_RedirectToAppStoreRatingPage_m1780619814': D:\_Projects\LOA_5.5_Android\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp-firstpass_4.cpp:43992: undefined reference to _MNP_RedirectToAppStoreRatingPage’
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)

at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(IEnumerable`1 objectFiles, CppToolChainContext toolChainContext)
at Unity.IL2CPP.Building.CppProgramBuilder.Build()
at il2cpp.Program.DoRun(String args)
at il2cpp.Program.Run(String args)
at il2cpp.Program.Main(String args)

UnityEngine.Debug:LogError(Object)
UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase, Action1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:96) UnityEditorInternal.IL2CPPBuilder:RunIl2CppWithArguments(List1, Action1, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:298) UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(ICollection1, String, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:289)
UnityEditorInternal.IL2CPPBuilder:Run() (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:131)
UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry, Boolean) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:32)
UnityEditor.HostView:OnGUI()

The problem in this case is the C# code in your project which has a extern static declaration for a method named MNP_ShowRateUsPopUp (and similar others). That method must exist in native code that is part of the build for Android. Otherwise, this error will occur.

To avoid this, you can us #if directives in the C# code to remove the MNP_ShowRateUsPopUp declaration from the build for Android.