3

I'm using unity 2019.2.0f1 with the integrating jdk-sdk and ndk recommended by unity to build a game for android platform first i build successfully my project using Mono after that i tried to build using IL2CPP unfortunately i couldn't build my game and got those errors in the console

    1error
Failed running C:\Program Files\Unity\Hub\Editor\2019.2.0f1\Editor\Data\il2cpp/build/il2cpp.exe --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile="unityaot" --compile-cpp --libil2cpp-static --platform="Android" --architecture="ARMv7" --configuration="Release" --outputpath="C:\Users\bechir\Documents\Unity 3D Projects\zagzig\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a\libil2cpp.so" --cachedirectory="C:\Users\bechir\Documents\Unity 3D Projects\zagzig\Assets\..\Library\il2cpp_android_armeabi-v7a/il2cpp_cache" --additional-include-directories="C:/Program Files/Unity/Hub/Editor/2019.2.0f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\bdwgc/include" --additional-include-directories="C:/Program Files/Unity/Hub/Editor/2019.2.0f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\libil2cpp/include" --tool-chain-path="C:/Program Files/Unity/Hub/Editor/2019.2.0f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK" --profiler-report --map-file-parser="C:/Program Files/Unity/Hub/Editor/2019.2.0f1/Editor/Data/Tools/MapFileParser/MapFileParser.exe" --directory="C:/Users/bechir/Documents/Unity 3D Projects/zagzig/Temp/StagingArea/assets/bin/Data/Managed" --generatedcppdir="C:/Users/bechir/Documents/Unity 3D Projects/zagzig/Temp/StagingArea/Il2Cpp/il2cppOutput" 

        stdout:
        Building libil2cpp.so with AndroidToolChain
            Output directory: C:\Users\bechir\Documents\Unity 3D Projects\zagzig\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a
            Cache directory: C:\Users\bechir\Documents\Unity 3D Projects\zagzig\Library\il2cpp_android_armeabi-v7a\il2cpp_cache
        il2cpp.exe didn't catch exception: System.AggregateException: Une ou plusieurs erreurs se sont produites. --->
        System.ComponentModel.Win32Exception: L'ex?cutable sp?cifi? n'est pas une application valide pour cette plateforme de syst?me d'exploitation.
           ?System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
           ?Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
           ?Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
           ?Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)
           --- Fin de la trace de la pile d'exception interne ---
         Unity.IL2CPP.Building.ParallelFor.RunWithResult[D,T](D[] data, Func`2 action)
        Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable`1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector)
        Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
        il2cpp.Program.DoRun(String[] args)
        il2cpp.Program.Run(String[] args)
         il2cpp.Program.Main(String[] args)
        ---> (Exception interne #0) System.ComponentModel.Win32Exception (0x80004005): L'ex?cutable sp?cifi? n'est pas une application valide pour cette plateforme de syst?me d'exploitation.
        ....


    2error
        Exception: C:\Program Files\Unity\Hub\Editor\2019.2.0f1\Editor\Data\il2cpp/build/il2cpp.exe did not run properly!
        UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:128)
        UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1[T] setupStartInfo) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:71)
        UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List`1[T] arguments, System.Action`1[T] setupStartInfo, System.String workingDirectory) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:502)
        UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (System.String inputDirectory, System.String outputDirectory, System.String workingDirectory, System.Boolean platformSupportsManagedDebugging) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:483)
        UnityEditorInternal.IL2CPPBuilder.Run () (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:334)
        UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:63)
        UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <8277255796414cc8b8865316c1676de5>:0)
        UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <8277255796414cc8b8865316c1676de5>:0)
        UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <8277255796414cc8b8865316c1676de5>:0)
        UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <8277255796414cc8b8865316c1676de5>:0)
        UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:281)
        UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
bechir
  • 31
  • 1
  • 1
  • 4
  • Same here, I have the following notes, none have worked. I have upgraded and down graded SDK's, NDK's Java environment, and UNity version from 2018 through beta 2019. – Jamie Nicholl-Shelley Aug 22 '19 at 17:34
  • finilly i make it work for me the solution was to use ndk-r16b so i used the sdk and jdk recommended but i changed the ndk to r16b version you can download it from here https://developer.android.com/ndk/downloads/older_releases.html – bechir Aug 22 '19 at 21:50
  • I attempted this also, I had a successful build but a final error when trying to place the build to an output dir. I have filed a bug report, awaiting reply. – Jamie Nicholl-Shelley Aug 24 '19 at 22:43
  • Check project preferences -> External Tools and make sure SDK, NDK, and JDK path are correct, in my case one was pointing to a different version. – observer Dec 16 '19 at 06:43

2 Answers2

0

I solved this problem but my platform is on Mac. This may be helpful for you.

I downloaded NDK r16b from Google but found it was very different from Unity Hub. Because many files and folders were missing. Also, the detail settings of Unity won't point NDK to the right place. So I used Unity Hub to download r16b and manually set it up.

Then it worked with Unity 2019 1.14f and 2019 2.14f.

Suggestion:

  • Download NDK by Unity Hub
  • Manually set NDK's path in Unity
Eric Wei
  • 141
  • 7
  • "So I used Unity Hub to download r16b and manually set it up." => How to download it using Unity Hub? – Huy Nguyen Mar 08 '20 at 15:44
  • Open. Unity Hub —> Installs —>Click an icon on the top right coroner of your Unity version —> you can select “Add Module” to download NDK for Android – Eric Wei Jul 26 '20 at 05:52
  • Looks like the option to install the NDK via Unity Hub is only available for unity 2019 and not 2018 or earlier – Bob-M Aug 13 '20 at 19:48
0

Use Android NDK r16b and set its path in Unity Editor.

Junaid Pathan
  • 3,850
  • 1
  • 25
  • 47