Search Unity

Bug Android il2cpp build fails due to System.IO.DirectoryNotFoundException on 2020.3.20f1

Discussion in 'Editor & General Support' started by Vir_man, Jul 20, 2022.

  1. Vir_man

    Vir_man

    Joined:
    Sep 25, 2019
    Posts:
    2
    Greetings, I have been having this problem for several days. I am trying to publish on Google Play but when trying to generate the .aab file it shows me the following errors:

    DirectoryNotFoundException: Could not find a part of the path 'E:\Workspace\Unity\Enchanted Duels\Temp\StagingArea\Il2Cpp\il2cppOutput\Data\Metadata'.
    System.IO.__Error.WinIOError (System.Int32 errorCode, System.String maybeFullPath) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    System.IO.FileSystemEnumerableIterator`1[TSource].HandleError (System.Int32 hr, System.String path) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    System.IO.FileSystemEnumerableIterator`1[TSource].CommonInit () (at <695d1cc93cca45069c528c15c9fdd749>:0)
    System.IO.FileSystemEnumerableIterator`1[TSource]..ctor (System.String path, System.String originalUserPath, System.String searchPattern, System.IO.SearchOption searchOption, System.IO.SearchResultHandler`1[TSource] resultHandler, System.Boolean checkHost) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    System.IO.FileSystemEnumerableFactory.CreateFileNameIterator (System.String path, System.String originalUserPath, System.String searchPattern, System.Boolean includeFiles, System.Boolean includeDirs, System.IO.SearchOption searchOption, System.Boolean checkHost) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    System.IO.Directory.InternalGetFileDirectoryNames (System.String path, System.String userPathOriginal, System.String searchPattern, System.Boolean includeFiles, System.Boolean includeDirs, System.IO.SearchOption searchOption, System.Boolean checkHost) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    System.IO.Directory.InternalGetFiles (System.String path, System.String searchPattern, System.IO.SearchOption searchOption) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    System.IO.Directory.GetFiles (System.String path) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    UnityEditorInternal.IL2CPPUtils.CopyMetadataFiles (System.String tempFolder, System.String destinationFolder) (at <83a38f5397d94e36a22efa3369c82390>:0)
    UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.FinalizeAndCleanup (System.String stagingArea, System.String assetsDataData, System.String il2cppDir, System.Collections.Generic.IEnumerable`1[T] targets) (at <f94168442e634613b6a5965ed17c38f4>:0)
    UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <f94168442e634613b6a5965ed17c38f4>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <f94168442e634613b6a5965ed17c38f4>: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 <f94168442e634613b6a5965ed17c38f4>:0)
    UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <f94168442e634613b6a5965ed17c38f4>: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 <83a38f5397d94e36a22efa3369c82390>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)

    Build completed with a result of 'Failed' in 323 seconds (323186 ms)
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

    UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
    at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in <83a38f5397d94e36a22efa3369c82390>:0
    at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <83a38f5397d94e36a22efa3369c82390>:0
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

    CompilationLog.txt
    # Starting compiling UnityEngine.TestRunner.dll
    E:\Unity\2020.3.20f1\Editor\Data\Tools\RoslynScripts\unity_csc.bat /noconfig @temp/UnityTempFile-6ef2e9c5bf745ad4481032c1f7a17c3b
    # Starting compiling UnityEngine.UI.dll
    E:\Unity\2020.3.20f1\Editor\Data\Tools\RoslynScripts\unity_csc.bat /noconfig @temp/UnityTempFile-ef11fe866fb247246b7e0d927ed6af1f
    # Starting compiling Unity.InternalAPIEngineBridge.001.dll
    E:\Unity\2020.3.20f1\Editor\Data\Tools\RoslynScripts\unity_csc.bat /noconfig @temp/UnityTempFile-df57ee55388df2e4c8eca903cac6a9d2
    # Starting compiling Unity.2D.PixelPerfect.dll
    E:\Unity\2020.3.20f1\Editor\Data\Tools\RoslynScripts\unity_csc.bat /noconfig @temp/UnityTempFile-768797393dbda414087cc77d9eeabeec
    # Starting compiling Unity.Timeline.dll
    E:\Unity\2020.3.20f1\Editor\Data\Tools\RoslynScripts\unity_csc.bat /noconfig @temp/UnityTempFile-534c06534580c574fa87d2de06271559
    # Starting compiling Unity.TextMeshPro.dll
    E:\Unity\2020.3.20f1\Editor\Data\Tools\RoslynScripts\unity_csc.bat /noconfig @temp/UnityTempFile-33b5ee6e931cec94bb63d7f2caa1fc45
    # Starting compiling UnityEngine.SpatialTracking.dll
    E:\Unity\2020.3.20f1\Editor\Data\Tools\RoslynScripts\unity_csc.bat /noconfig @temp/UnityTempFile-5924bc3583eb99347bc59ae351266990
    # Starting compiling com.unity.multiplayer-hlapi.Runtime.dll
    E:\Unity\2020.3.20f1\Editor\Data\Tools\RoslynScripts\unity_csc.bat /noconfig @temp/UnityTempFile-f712fc0713b3f414c92b6479364be4fb
    # Starting compiling Unity.Mathematics.dll
    E:\Unity\2020.3.20f1\Editor\Data\Tools\RoslynScripts\unity_csc.bat /noconfig @temp/UnityTempFile-950a5b9cb4fafd74493448ddc84d2966
    # Starting compiling Unity.2D.IK.Runtime.dll
    E:\Unity\2020.3.20f1\Editor\Data\Tools\RoslynScripts\unity_csc.bat /noconfig @temp/UnityTempFile-2ec219f2bd009f041a58bdff50d8d3c7
    # Starting compiling UnityEngine.XR.LegacyInputHelpers.dll
    E:\Unity\2020.3.20f1\Editor\Data\Tools\RoslynScripts\unity_csc.bat /noconfig @temp/UnityTempFile-aea9648bac6a0dc4b8420b9e125955be
    # Starting compiling Unity.2D.Animation.Triangle.Runtime.dll
    E:\Unity\2020.3.20f1\Editor\Data\Tools\RoslynScripts\unity_csc.bat /noconfig @temp/UnityTempFile-50b7b3784ad5a6b4cb94eb0c94c72458
    # Starting compiling Unity.2D.Common.Runtime.dll
    E:\Unity\2020.3.20f1\Editor\Data\Tools\RoslynScripts\unity_csc.bat /noconfig @temp/UnityTempFile-917c70202ead1824e98053582358f23e
    # Starting compiling Unity.2D.Animation.Runtime.dll
    E:\Unity\2020.3.20f1\Editor\Data\Tools\RoslynScripts\unity_csc.bat /noconfig @temp/UnityTempFile-8549d8c5818f71e4296d204936e385da
    # Starting compiling Unity.2D.SpriteShape.Runtime.dll
    E:\Unity\2020.3.20f1\Editor\Data\Tools\RoslynScripts\unity_csc.bat /noconfig @temp/UnityTempFile-a6e2739f67b999f4b980eeb56705477e
    # Starting compiling Assembly-CSharp.dll
    E:\Unity\2020.3.20f1\Editor\Data\Tools\RoslynScripts\unity_csc.bat /noconfig @temp/UnityTempFile-a72913f579939954bb2120088328a5cd

    If I choose Mono I can correctly generate the .apk file, but with IL2CPP I cannot generate either the apk or the abb
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,726
    Android build not building:

    First, make a blank project with a single blank scene and prove that it builds successfully.

    If it does NOT build, then go fix your Unity installation, or your other tools, such as Android SDK, NDK, JDK, etc.

    Until you can build a blank project to the target platform, don't fiddle with anything else.

    Once you can build a blank project, now bisect the problem by bringing over parts of your current project and building it one subsystem at a time, perhaps stubbing things out that might trigger compiler errors.

    Most often things that prevent building are third-party libraries such as Firebase.

    Once you identify the subsystem, go to the documentation for it and make sure you are doing it correctly.

    It may also be helpful to work through a tutorial or two for that subsystem.
     
  3. Vir_man

    Vir_man

    Joined:
    Sep 25, 2019
    Posts:
    2
    upload_2022-7-21_9-18-34.png
    Blank project build succesfully.
    I will review each part of the project following your instructions, thank you very much!