Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed Exporting #311

Closed
jain-aayush1123 opened this issue Feb 2, 2021 · 7 comments
Closed

Failed Exporting #311

jain-aayush1123 opened this issue Feb 2, 2021 · 7 comments

Comments

@jain-aayush1123
Copy link

On exporting for android, the build fails. Have followed #234 (comment) to export for Unity 2019. The error says IL2CPP failed. I am using the correct NDK and all.
The Complete error is -

`Exception: C:\Program Files\Unity\Hub\Editor\2019\2019.4.14f1\Editor\Data\il2cpp/build/deploy/net471/il2cpp.exe did not run properly!

Failed running "C:\Program Files\Unity\Hub\Editor\2019\2019.4.14f1\Editor\Data\il2cpp/build/deploy/net471/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\aayus\Desktop\Projects\Adherence\adherence\unity\TEST\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a\libil2cpp.so" --cachedirectory="C:\Users\aayus\Desktop\Projects\Adherence\adherence\unity\TEST\Assets..\Library\il2cpp_android_armeabi-v7a/il2cpp_cache" --additional-include-directories="C:/Program Files/Unity/Hub/Editor/2019/2019.4.14f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\bdwgc/include" --additional-include-directories="C:/Program Files/Unity/Hub/Editor/2019/2019.4.14f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\libil2cpp/include" --tool-chain-path="C:/Program Files/Unity/Hub/Editor/2019/2019.4.14f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK" --profiler-report --map-file-parser="C:/Program Files/Unity/Hub/Editor/2019/2019.4.14f1/Editor/Data/Tools/MapFileParser/MapFileParser.exe" --directory=C:/Users/aayus/Desktop/Projects/Adherence/adherence/unity/TEST/Temp/StagingArea/assets/bin/Data/Managed --generatedcppdir=C:/Users/aayus/Desktop/Projects/Adherence/adherence/unity/TEST/Temp/StagingArea/Il2Cpp/il2cppOutput
stdout:
Building libil2cpp.so with AndroidToolChain
Output directory: C:\Users\aayus\Desktop\Projects\Adherence\adherence\unity\TEST\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a
Cache directory: C:\Users\aayus\Desktop\Projects\Adherence\adherence\unity\TEST\Library\il2cpp_android_armeabi-v7a\il2cpp_cache
ObjectFiles: 224 of which compiled: 0
Total compilation time: 1592 milliseconds.
il2cpp.exe didn't catch exception: Unity.IL2CPP.Building.BuilderFailedException: C:\Program Files\Unity\Hub\Editor\2019\2019.4.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++ @"C:\Users\aayus\AppData\Local\Temp\tmpA625.tmp" -o "C:\Users\aayus\Desktop\Projects\Adherence\adherence\unity\TEST\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_0C8B74D794677D83745211577FF1C765\libil2cpp.so" -shared -Wl,-soname,libil2cpp.so -Wl,--no-undefined -Wl,-z,noexecstack -Wl,--gc-sections -Wl,--build-id -stdlib=libc++ -static-libstdc++ -target armv7-linux-androideabi19 -Wl,--wrap,sigaction -llog -rdynamic -fuse-ld=gold.exe

at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet1 objectFiles, CppToolChainContext toolChainContext) at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics) at il2cpp.Program.DoRun(String[] args, List1 foundAssemblies)
at il2cpp.Program.Run(String[] args, Boolean setInvariantCulture)
at il2cpp.Program.Main(String[] args)
stderr:

Unhandled Exception: Unity.IL2CPP.Building.BuilderFailedException: C:\Program Files\Unity\Hub\Editor\2019\2019.4.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++ @"C:\Users\aayus\AppData\Local\Temp\tmpA625.tmp" -o "C:\Users\aayus\Desktop\Projects\Adherence\adherence\unity\TEST\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_0C8B74D794677D83745211577FF1C765\libil2cpp.so" -shared -Wl,-soname,libil2cpp.so -Wl,--no-undefined -Wl,-z,noexecstack -Wl,--gc-sections -Wl,--build-id -stdlib=libc++ -static-libstdc++ -target armv7-linux-androideabi19 -Wl,--wrap,sigaction -llog -rdynamic -fuse-ld=gold.exe
UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <68af50843d0a45398c92799647332ec2>:0) UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <12a2b75af02641e99fa5d5b4bf0b41f7>:0) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <12a2b75af02641e99fa5d5b4bf0b41f7>: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 <12a2b75af02641e99fa5d5b4bf0b41f7>:0) UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <12a2b75af02641e99fa5d5b4bf0b41f7>: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 <68af50843d0a45398c92799647332ec2>:0) UnityEditor.BuildPipeline:BuildPlayer(String[], String, BuildTarget, BuildOptions) Build:DoBuildAndroid(String, Boolean) (at Assets/FlutterUnityIntegration/Editor/Build.cs:56) Build:DoBuildAndroidLibrary() (at Assets/FlutterUnityIntegration/Editor/Build.cs:23)

the other error is -
Exception: Build failed Build.DoBuildAndroid (System.String buildPath, System.Boolean isPlugin) (at Assets/FlutterUnityIntegration/Editor/Build.cs:64) Build.DoBuildAndroidLibrary () (at Assets/FlutterUnityIntegration/Editor/Build.cs:23)

  • OS: Windows
  • Unity - 2019.4.14f1
@burakkurtarir
Copy link

Opened Build.cs file and edited it : changed doBuild function of the android target
looking for this line
var options = BuildOptions.AllowDebugging.AcceptExternalModificationsToPlayer;
and change it to something else like that
var options = BuildOptions.AllowDebugging;
and it worked.

#234 (comment)

@jain-aayush1123
Copy link
Author

Opened Build.cs file and edited it : changed doBuild function of the android target
looking for this line
var options = BuildOptions.AllowDebugging.AcceptExternalModificationsToPlayer;
and change it to something else like that
var options = BuildOptions.AllowDebugging;
and it worked.

#234 (comment)

yeah that works when there is build failed to append error. here there was a problem with il2cpp not able to compile OpenURL library of unity. I got rid of those functions and it worked.
Thanks for your help ☺

@cmd-dev
Copy link

cmd-dev commented Mar 20, 2021

Which functions did you remove? @jain-aayush1123 What exactly did you do?

@jain-aayush1123
Copy link
Author

Which functions did you remove? @jain-aayush1123 What exactly did you do?

So in my error it showed that the build was failing because of two functions which launched and closed URLs. Apparently, IL2CPP was not able to build those two. So I removed them and it was able to build.
Apart from that you need to follow #234 (comment)

Hope that helps

@cmd-dev
Copy link

cmd-dev commented Mar 20, 2021

Thanks for the reply! @jain-aayush1123

But, I followed #234 -

public static void DoBuildAndroid(String buildPath, bool isPlugin)
{
    if (Directory.Exists(apkPath))
        Directory.Delete(apkPath, true);

    if (Directory.Exists(androidExportPath))
        Directory.Delete(androidExportPath, true);

    // EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Gradle;

    // var options = BuildOptions.AcceptExternalModificationsToPlayer;
    var options = BuildOptions.AllowDebugging;
    EditorUserBuildSettings.exportAsGoogleAndroidProject = true;

    var report = BuildPipeline.BuildPlayer(
        GetEnabledScenes(),
        apkPath,
        BuildTarget.Android,
        options
    );

    if (report.summary.result != BuildResult.Succeeded)
        throw new Exception("Build failed");

    Copy(buildPath, androidExportPath);

...

I still get the same error for some reason.

@jain-aayush1123
Copy link
Author

@cmd-dev you might have to go through your error log to figure out what's failing the build. It seems to pop up the roughly same error for multiple reasons. The error logs give the functions or classes which are failing the build. Try to remove those or find a workaround.

@cmd-dev
Copy link

cmd-dev commented Mar 20, 2021

Okay thank you.

The problem was due to no disk space being left. I made some space and restarted my laptop and it fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants