Search Unity

Question Gitlab runner can not build for android (Failed to transform core-1.18.0.aar)

Discussion in 'Testing & Automation' started by Brandstifter, Sep 17, 2021.

  1. Brandstifter

    Brandstifter

    Joined:
    Jan 24, 2020
    Posts:
    3
    Hi,
    i want to use a gitlab ci/cd pipeline to build a unity project for android, but i always get an exception when building via the gitlab runner. In the build process, the file "C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\0a99946ff9efad846584afde19e18d54\com.google.ar.core" cannot be found.

    Does anyone know the issue and can help me?

    What I have tried:
    - tested with different versions of unity, always the same error (2020.3.17f1, 2021.1.21f1)
    - gradle cache folder deleted
    - the build via the graphical user interface in unity works (unfortunately not with the gitlab runner)
    - gitlab runner tested on different systems without success (OS: Windows 10 Education)

    Error:
    Code (CSharp):
    1. Note: C:\GitLab-Runner\builds\zhiTic4m\0\robotik\mixed-reality\demo-suitcase-b4kmu\Demo-Suitcase-B4KMU\Temp\gradleOut\unityLibrary\src\main\java\com\unity3d\player\UnityPlayerActivity.java uses or overrides a deprecated API.
    2. Note: Recompile with -Xlint:deprecation for details.
    3.  
    4. FAILURE: Build failed with an exception.
    5.  
    6. * What went wrong:
    7. Execution failed for task ':launcher:processReleaseResources'.
    8. > Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'.
    9.    > Failed to transform core-1.18.0.aar (com.google.ar:core:1.18.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
    10.       > Execution failed for AarResourcesCompilerTransform: C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\50f86642d2da7f4ef928c1741c7d6a77\core-1.18.0.
    11.          > Android resource compilation failed
    12.            AAPT: C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\0a99946ff9efad846584afde19e18d54\com.google.ar.core: error: Das System kann die angegebene Datei nicht finden. (2).
    13.        
    14.            
    15.  
    16. * Try:
    17. 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.
    18.  
    19. * Get more help at https://help.gradle.org
    20.  
    21. BUILD FAILED in 19s
    22. Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    23. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    24. UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    25. UnityEngine.Logger:Log (UnityEngine.LogType,object)
    26. UnityEngine.Debug:LogError (object)
    27. UnityEditor.Android.GradleInvokationException:ParseAndShowException ()
    28. UnityEditor.Android.PostProcessor.PostProcessRunner:RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext)
    29. UnityEditor.Android.PostProcessAndroidPlayer:PostProcess (UnityEditor.BuildTarget,string,string,string,string,string,string,UnityEditor.BuildOptions,UnityEditor.RuntimeClassRegistry,UnityEditor.Build.Reporting.BuildReport)
    30. UnityEditor.Android.AndroidBuildPostprocessor:PostProcess (UnityEditor.Modules.BuildPostProcessArgs,UnityEditor.BuildProperties&)
    31. UnityEditor.PostprocessBuildPlayer:Postprocess (UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,string,string,string,int,int,UnityEditor.BuildOptions,UnityEditor.RuntimeClassRegistry,UnityEditor.Build.Reporting.BuildReport)
    32. UnityEditor.BuildPipeline:BuildPlayerInternal (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,UnityEditor.BuildOptions,string[])
    33. UnityEditor.BuildPipeline:BuildPlayer (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,UnityEditor.BuildOptions,string[])
    34. UnityEditor.BuildPipeline:BuildPlayer (UnityEditor.BuildPlayerOptions)
    35. BuildScript:BuildAndroid () (at Assets/Scripts/Editor/BuildScript.cs:32)
     
    Last edited: Sep 17, 2021
  2. jokigenki

    jokigenki

    Joined:
    Jul 19, 2014
    Posts:
    41
    I am also getting error. Builds fine through Unity, and also when run directly from the command line, but not when run with gitlab runner.
     
    Last edited: Mar 18, 2022
  3. jokigenki

    jokigenki

    Joined:
    Jul 19, 2014
    Posts:
    41
  4. weilunchujumbo

    weilunchujumbo

    Joined:
    Jan 16, 2022
    Posts:
    1
    I have a gitlab windows runner, and powershell executor to build Androind.
    Run Command line Build is OK, but gitlab ci always failed.

    I go to Compare Successed and Failed log.

    I find this weird log like this:

    Success:
    DisplayProgressbar: Detecting Android SDK
    File C:\Users\Administrator\.android\repositories.cfg could not be loaded.

    Failed
    DisplayProgressbar: Detecting Android SDK
    File C:\Windows\system32\config\systemprofile\.android\repositories.cfg could not be loaded.

    I guess gitlab runner use wrong path.
    I finally fix this problem by add "GRADILE_USER_HOME" in gitlab yaml, and set value to my gitlab windows runners user, like this:

    variables:
    GRADLE_USER_HOME: 'C:\Users\ABC\'

    Now, My gitlab ci can build APK.
    Hope it helps you
     
    Last edited: Apr 14, 2022
    Liiii00 and Hellfim like this.
  5. erdemsaray09

    erdemsaray09

    Joined:
    Jul 18, 2022
    Posts:
    1

    Hi, I created my account to thank you for this comment. I encountered this error while creating gitlab ci.yml file for Flutter. I added the Variable as below and it works fine now. Thanks..

    Variable:
    GRADLE_USER_HOME: 'C:\Users\erdem\.gradle'

    I am attaching the errors I received below so that people who have similar problems can find a solution.

    ###################################################

    Execution failed for task ':app:processReleaseResources'.
    A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
    Android resource linking failed
    C:\Gitlab-Runner\builds\NBQgA9_7\0\erdem\proje\android\app\src\main\res\values\styles.xml:4:5-8:13: AAPT: error: resource drawable/launch_background (aka com.example.proje:drawable/launch_background) not found.

    #####################################################

    Running Gradle task 'assembleRelease'...
    FAILURE: Build failed with an exception.
    What went wrong:
    Execution failed for task ':app:mergeReleaseResources'.
    Multiple task action failures occurred:
    failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
    Android resource compilation failed
    C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\122df2e57d294d1a53db26bbc3b813c1\core-1.6.0\res\drawable-mdpi-v4\notification_bg_normal.9.png: AAPT: error: file not found.
    A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
    Android resource compilation failed

    #########################################################
     
    Stader and Hellfim like this.
  6. chasehek

    chasehek

    Joined:
    Feb 4, 2017
    Posts:
    4
    It's help me! Thanks, guys. I'm really excited finally!
     
  7. Liiii00

    Liiii00

    Joined:
    Aug 7, 2021
    Posts:
    5
    It help me!!! Thanks!!!!!


    I use TeamCity as CI tool, with a simple command line to build android apk.

    Add GRADLE_USER_HOME:C:\Users\%Username%\.gradle to environment variable and build success!
    upload_2024-1-28_22-55-46.png
     
    Stader likes this.