Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-53689

Unity3d Failed To Build due to mergeReleaseResources FAILED error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Component/s: unity3d-plugin
    • Environment:
      Unity 2018.1.4f1
      jenkins-2.138.1
      unity3d-plugin 1.3
      Windows 10.0.17134 Build 17134
      java version 1.8.0_111
      gradle-3.1
    • Similar Issues:

      Description

      Hello, I'm pretty new to jenkins, my ultimate goal is to automatize our building process via jenkins. We develop android games in Unity3D and looking for a faster way to build and distribute apk's within the company(locally) & without disturbing the focus of the developers. For this, I thought jenkins suits us just fine. 

      However I could not seem to be able to build an apk file with jenkins. The error is as follows:

       

      AAPT: \\?\C:\Windows\System32\config\systemprofile\.android\build-cache\94dd60f9b7ad7cfd8a707aecec622ec889ba6fe0\output\res\drawable-hdpi-v4\abc_switch_track_mtrl_alpha.9.png ERROR: Unable to open PNG file
      AAPT: \\?\C:\Windows\System32\config\systemprofile\.android\build-cache\94dd60f9b7ad7cfd8a707aecec622ec889ba6fe0\output\res\drawable-mdpi-v4\abc_list_selector_disabled_holo_dark.9.png ERROR: Unable to open PNG file
      AAPT: \\?\C:\Windows\System32\config\systemprofile\.android\build-cache\94fda840629a346551b22f36b23366b18cbaef8e\output\res\drawable-hdpi-v4\com_facebook_tooltip_black_background.9.png ERROR: Unable to open PNG file
      .....
      Error: Some file crunching failed, see logs for details
      :mergeReleaseResources FAILED
      261 actionable tasks: 261 executed
      

      There are a lot more of this AAPT lines but I've only put these for ease of reading. I did some research, there were not a lot of people experienced this issue with Unity but rather with android. Some of the suggestions as follows:

      • The path is too long so it couldn't be opened. I tried to change the user.home Environment Variable to something shorter, but it still gave same errors with same paths. Note that I restarted jenkins before taking the build after I set user.home. Also note that these files were created at the path that I've assigned, but it seems that they are not used somehow.
      • add android.enableBuildCache=false to gradle.properties. I didn't want to do that, since android recommends build cache to be enabled since it reduces build time, also I don't want to mingle with gradle files in unity, we are using the default one which was provided by Unity.
      • The files are actually somehow jpgs, or files are corrupted. I selected some of them and opened the files randomly, they all were successfully opened.

       

      From this part, I'm going to explain what I've tried so far.

      I've tried this with 2 different windows PC's. But the result is the same. On the first one:

      • I've successfully integrated jenkins with our gitlab repo.
      • I used unity3d build plugin

      On the second one:

      • I directly gave command line arguments to local repo without integrating gitlab.
      • I've tested both with unity3d build plugin and Execute windows batch command.

      I've configured unity3d build plugin as suggested in it's page and used this command line arguments:

       

      -quit -batchmode -executeMethod ContinousIntegration.Build.PerformAndroidBuild -logfile "C:\Users\Dogukan\AppData\Local\Unity\Editor\Editor.log"
      

      Then I wanted to try my Editor Script without Jenkins: 

       

      • First I put a MenuItem attribute so I could start it within Unity Editor, the apk has been successfully built.
      • Then I tried to do it with command line, my command line was like this:

       

      "C:\Program Files\Unity\Hub\Editor\2018.1.4f1\Editor\Unity.exe" -projectPath "E:\Projects\critical-strike" -quit -batchmode -executeMethod ContinousIntegration.Build.PerformAndroidBuild -logfile "C:\Users\Dogukan\AppData\Local\Unity\Editor\Editor.log"
      

      It successfully built again.

      Lastly, I tried to use command line in jenkins, so Instead of using unity3d-plugin I used Execute Windows batch command in Build tab on the job config. The command was the same that I've previously used directly in command line, same error again.

      Now to sum up, I've tested this on 2 different Windows PC's and both of them were worked without Jenkins(Both Unity Editor and in Command Line) but with Jenkins, I received the aforementioned error. My last resort was to write here and explain the situation, hoping to find a solution or a fix. I'm happy to provide more information if the explanation is too vague or deficient.

       

       

       

        Attachments

          Activity

          Hide
          vandarthul Dogukan Erkut added a comment -

          It seems that the issue was caused due to being a SYSTEM user rather than my own admin user. Follow this link, instead of "Team City Build Agent", look for "Jenkins" service and Log on with your own user, then the build can proceed without any problems.

          Show
          vandarthul Dogukan Erkut added a comment - It seems that the issue was caused due to being a SYSTEM user rather than my own admin user. Follow this link , instead of "Team City Build Agent", look for "Jenkins" service and Log on with your own user, then the build can proceed without any problems.

            People

            • Assignee:
              vandarthul Dogukan Erkut
              Reporter:
              vandarthul Dogukan Erkut
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: