ERROR: Unable to instantiate instance of 'FreeType2' object type from compiled assembly

Hi All,

I am working on porting a UE project to android and I am unable to launch it to an android phone. This project has been working well and has been packaged into Windows, Mac and iOS platforms. I am using UE ver 4.14 and am building for Android SDK level 21 and NDK level ‘latest’ . This is the first time I am using UE4 Ver 4.14

Here is a short version of the bug:

ERROR: Unable to instantiate instance
of ‘FreeType2’ object type from
compiled assembly ‘UE4Rules,
Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null’. Unreal Build
Tool creates an instance of your
module’s ‘Rules’ object in order to
find out about your module’s
requirements.

Thanks

Here is the longer version of the error that I am getting:

LogPlayLevel: Project.Build: ********** BUILD COMyProjectAND STARTED **********
LogPlayLevel: Completed Launch On Stage: Build Task, Time: 2.272504
LogPlayLevel: CommandUtils.Run: Run: mono "/Users/Shared/UnrealEngine/4.14/Engine/Binaries/DotNET/UnrealBuildTool.exe" MyProject_04 Android Development -Project=/Users/Userd/Documents/MyProject/MyProject_04.uproject  /Users/Userd/Documents/MyProject/MyProject_04.uproject  -remoteini="/Users/Userd/Documents/MyProject" -noxge -generatemanifest -nocreatestub -NoHotReload
LogPlayLevel: UnrealBuildTool: NDK version: 24, GccVersion: 4.9
LogPlayLevel: UnrealBuildTool: ERROR: Unable to instantiate instance of 'FreeType2' object type from compiled assembly 'UE4Rules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.  Unreal Build Tool creates an instance of your module's 'Rules' object in order to find out about your module's requirements.  The CLR exception details may provide more info
rmation:  System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method 'Array.Empty' not found.
LogPlayLevel: UnrealBuildTool:   at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
LogPlayLevel: UnrealBuildTool:   at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
LogPlayLevel: UnrealBuildTool:   --- End of inner exception stack trace ---
LogPlayLevel: UnrealBuildTool:   at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
LogPlayLevel: UnrealBuildTool:   at System.Reflection.MonoCMethod.DoInvoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
LogPlayLevel: UnrealBuildTool:   at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
LogPlayLevel: UnrealBuildTool:   at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00000] in <filename unknown>:0
LogPlayLevel: UnrealBuildTool:   at System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) [0x00000] in <filename unknown>:0
LogPlayLevel: UnrealBuildTool:   at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in <filename unknown>:0
LogPlayLevel: UnrealBuildTool:   at UnrealBuildTool.RulesAssembly.CreateModuleRules (System.String ModuleName, UnrealBuildTool.TargetInfo Target, UnrealBuildTool.FileReference& ModuleFileName) [0x00000] in <filename unknown>:0
LogPlayLevel: CommandUtils.Run: Run: Took 1.176452s to run mono, ExitCode=5
LogPlayLevel: Program.Main: ERROR: AutomationTool terminated with exception: AutomationTool.CommandUtils+CommandFailedException: Command failed (Result:5): /Users/Shared/UnrealEngine/4.14/Engine/Binaries/DotNET/UnrealBuildTool.exe MyProject_04 Android Development -Project=/Users/Userd/Documents/MyProject/MyProject_04.uproject  /Users/Userd/Documents/MyProject/MyProject_04.uproject  -remoteini="
/Users/Userd/Documents/MyProject" -noxge -generatemanifest -nocreatestub -NoHotReload. See logfile for details: 'UnrealBuildTool-2017.01.18-12.47.00.txt'

Did you install Java 8?

Yes. I do have Java 8 installed.

Did you find any solutions ?

Same problem and same engine version.

In my case, Verifying Engine source fixed it.

What do you mean about “Verifiying Engine source” ?

I have duplicate my 4.14 project to a 4.15 preview version and that’s fix the error for me.

I accidently changed the engine source code and it occurs the error. You can verify the engine source in Epic Games Launcher

Nope… I have freetype in my system. I tried adding freetype as a dependency in the build script… nothing seems to have worked.

I did try ‘Verifying Engine’ earlier… didnt work for me.

It might be caused by Mono. You can uninstall Mono framework and try again.

The UE4 run in two environments when build your game if your machine already installed Mono.
It should be the UE4’s build/package script is incompatible with Mono framework.

Hi

Thanks so much for answering this question. For some reason, this error is specific to this project and I have other projects that are working fine. I am a bit worried at the idea of uninstalling mono and reinstalling it, as I am afraid that this might affect my other projects. I am glad that you responded to this question, but can you be a bit more specific as to which part of the build script might be causing this conflict with Mono framework OR have you seen this problem before ?

Thanks

Yes, I also get same error in macOS. Then I remove the Mono framework and all things is right.