Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Build error on Android

Discussion in 'Android' started by Bagazi, Oct 7, 2021.

  1. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    609
    I got a compile error like below:

    But I dont know how to execute this:
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    Is this a compile cmd or script? How to implement it?
    -----------------------------------------------------------------------------
    CommandInvokationFailure: Gradle build failed.
    C:\Program Files\Unity\Hub\Editor\2021.1.23f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2021.1.23f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-6.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleDebug"

    stderr[

    FAILURE: Build failed with an exception.

    * Where:
    Build file 'D:\WorkSpace\GamePro\GameB-Android\Unity-Proj\GameB\Games\Android\unityLibrary\build.gradle' line: 55

    * What went wrong:
    Execution failed for task ':unityLibrary:BuildIl2CppTask'.
    > Process 'command 'D:/WorkSpace/GamePro/GameB-Android/Unity-Proj/GameB/Games/Android/unityLibrary/src/main/Il2CppOutputProject/IL2CPP/build/deploy/netcoreapp3.1/il2cpp.exe'' finished with non-zero exit value 4

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    * Get more help at https://help.gradle.org

    BUILD FAILED in 38s
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    ]
    stdout[

    > Configure project :launcher
    WARNING: The option setting 'android.enableR8=false' is deprecated.
    It will be removed in version 5.0 of the Android Gradle plugin.
    You will no longer be able to disable R8
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2021.1.23f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\30.0.2\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2021.1.23f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2021.1.23f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-29\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2021.1.23f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only

    > Task :launcher:preBuild UP-TO-DATE
    > Task :unityLibrary:preBuild UP-TO-DATE
    > Task :launcher:preDebugBuild UP-TO-DATE
    > Task :unityLibrary:preDebugBuild UP-TO-DATE
    > Task :unityLibrary:compileDebugAidl NO-SOURCE
    > Task :unityLibrary:packageDebugRenderscript NO-SOURCE
    > Task :launcher:generateDebugBuildConfig UP-TO-DATE
    > Task :unityLibrary:compileDebugRenderscript NO-SOURCE
    > Task :launcher:compileDebugAidl NO-SOURCE
    > Task :launcher:compileDebugRenderscript NO-SOURCE
    > Task :unityLibrary:generateDebugResValues UP-TO-DATE
    > Task :unityLibrary:generateDebugResources UP-TO-DATE
    > Task :launcher:javaPreCompileDebug UP-TO-DATE
    > Task :launcher:generateDebugResValues UP-TO-DATE
    > Task :launcher:generateDebugResources UP-TO-DATE
    > Task :launcher:createDebugCompatibleScreenManifests UP-TO-DATE
    > Task :launcher:extractDeepLinksDebug UP-TO-DATE
    > Task :unityLibrary:packageDebugResources UP-TO-DATE
    > Task :launcher:mergeDebugShaders UP-TO-DATE
    > Task :unityLibrary:extractDeepLinksDebug UP-TO-DATE
    > Task :unityLibrary:compileDebugLibraryResources UP-TO-DATE
    > Task :unityLibrary:parseDebugLocalResources UP-TO-DATE
    > Task :unityLibrary:generateDebugBuildConfig UP-TO-DATE
    > Task :unityLibrary:javaPreCompileDebug UP-TO-DATE
    > Task :unityLibrary:mergeDebugShaders UP-TO-DATE
    > Task :unityLibrary:compileDebugShaders NO-SOURCE
    > Task :unityLibrary:generateDebugAssets UP-TO-DATE
    > Task :launcher:mergeDebugResources UP-TO-DATE
    > Task :launcher:compileDebugShaders NO-SOURCE
    > Task :launcher:generateDebugAssets UP-TO-DATE
    > Task :launcher:processDebugJavaRes NO-SOURCE
    > Task :launcher:checkDebugDuplicateClasses UP-TO-DATE
    > Task :launcher:desugarDebugFileDependencies UP-TO-DATE
    > Task :launcher:mergeExtDexDebug UP-TO-DATE
    > Task :launcher:mergeDebugJniLibFolders UP-TO-DATE
    > Task :launcher:validateSigningDebug UP-TO-DATE
    > Task :unityLibrary:packageDebugAssets
    > Task :unityLibrary:processDebugJavaRes NO-SOURCE
    > Task :unityLibrary:bundleLibResDebug NO-SOURCE
    > Task :launcher:mergeDebugAssets
    > Task :launcher:mergeDebugJavaResource UP-TO-DATE

    > Task :unityLibrary:BuildIl2CppTask
    Building libil2cpp.so with AndroidToolChain
    Output directory: D:\WorkSpace\GamePro\GameB-Android\Unity-Proj\GameB\Games\Android\unityLibrary\src\main\jniLibs\arm64-v8a
    Cache directory: D:\WorkSpace\GamePro\GameB-Android\Unity-Proj\GameB\Games\Android\unityLibrary\build\il2cpp_arm64-v8a_Release\il2cpp_cache
    ObjectFiles: 621 of which compiled: 0
    Total compilation time: 1005 milliseconds.

    > Task :unityLibrary:processDebugManifest

    > Task :unityLibrary:BuildIl2CppTask FAILED
    Error: Unity.IL2CPP.Building.BuilderFailedException: C:\Program Files\Unity\Hub\Editor\2021.1.23f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++ @"C:\Users\70442\AppData\Local\Temp\tmp6816.tmp" -o "D:\WorkSpace\GamePro\GameB-Android\Unity-Proj\GameB\Games\Android\unityLibrary\build\il2cpp_arm64-v8a_Release\il2cpp_cache\linkresult_68DA77C9F01793E2FAA7B7191EC75A11\libil2cpp.so" -shared -Wl,-soname,libil2cpp.so -Wl,--no-undefined -Wl,-z,noexecstack -Wl,--gc-sections -Wl,--build-id -stdlib=libc++ -static-libstdc++ -target aarch64-linux-android21 -Wl,--wrap,sigaction "D:\WorkSpace\GamePro\GameB-Android\Unity-Proj\GameB\Games\Android\unityLibrary\src\main\jniStaticLibs\arm64-v8a\baselib.a" -llog -rdynamic -fuse-ld=bfd.exe

    C:\Program Files\Unity\Hub\Editor\2021.1.23f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin\ld.bfd.exe: final link failed: No space left on device
    clang++: error: linker command failed with exit code 1 (use -v to see invocation)


    at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet`1 objectFiles, CppToolChainContext toolChainContext)
    at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
    at il2cpp.Compilation.CompilationDriver.Run(RuntimePlatform platform, BuildingOptions buildingOptions, ReadOnlyCollection`1 matchedAssemblyMethodSourceFiles)
    at il2cpp.Program.DoRun(String[] args, RuntimePlatform platform, BuildingOptions buildingOptions, Boolean throwExceptions)
    25 actionable tasks: 4 executed, 21 up-to-date
    ]
    exit code: 1
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <0c192019caaf4c40b2a802c9e7d19c9a>:0)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <0c192019caaf4c40b2a802c9e7d19c9a>:0)
    UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <0c192019caaf4c40b2a802c9e7d19c9a>:0)
    UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <0c192019caaf4c40b2a802c9e7d19c9a>:0)
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <0c192019caaf4c40b2a802c9e7d19c9a>:0)
    Rethrow as GradleInvokationException: Gradle build failed
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <0c192019caaf4c40b2a802c9e7d19c9a>:0)
    UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <0c192019caaf4c40b2a802c9e7d19c9a>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <0c192019caaf4c40b2a802c9e7d19c9a>:0)
    Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
    UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <0c192019caaf4c40b2a802c9e7d19c9a>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <0c192019caaf4c40b2a802c9e7d19c9a>: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 <0c192019caaf4c40b2a802c9e7d19c9a>:0)
    UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <0c192019caaf4c40b2a802c9e7d19c9a>: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 <28b3bc2fb649479b87f9038effa3c5ac>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)
     
  2. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    609
    PS: I build via Unity instead of exported android project
     
  3. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,853
    Try running as admin and let me know.

    ?
     
  4. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    609
    Run what as admin?:) Unity or something else?


    There is no space ? I didnt mention the error tip.. I am going to deleting files...
     
  5. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,853
    Unity!
     
  6. AndresQAndroid

    AndresQAndroid

    Joined:
    Jun 5, 2019
    Posts:
    2
    I'm running into the same error trying to Compile the latest example of "how to include Unity as a lib in a native android app".