DevAnuragGarg
DevAnuragGarg

Reputation: 1742

Jenkins Android Build Error: FAILURE: Build failed with an exception

I have been trying to do CI using Jenkins for my Android application. I am new to this. After following some of the tutorials, I am able to atleast set up and run the build now option. It download every pom required but while building it give below error.

============================================ C:\Windows\System32\config\systemprofile.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\e796469c387c11565d873216f24c3b6f\res\drawable\abc_ic_go_search_api_material.xml: error: file not found. C:\Windows\System32\config\systemprofile.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\7207fbd3bdb6cb696445cfc77c16e5ed\res\drawable-hdpi-v4\googleg_standard_color_18.png: error: file not found. C:\Windows\System32\config\systemprofile.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\e796469c387c11565d873216f24c3b6f\res\layout\select_dialog_singlechoice_material.xml: error: file not found. Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details :app:mergeDebugResources FAILED

FAILURE: Build failed with an exception.

======================================================

Can you please let me know how to resolve it? Do let me know if anything else is required.

Upvotes: 0

Views: 1772

Answers (4)

The Anh Ng
The Anh Ng

Reputation: 1

When using Jenkins with Window to build Android, I face this problem myself. I fix by add GRADLE_USER_HOME to Environment Variable:

GRADLE_USER_HOME = C:\Users\*MyUserName*\.gradle

hope this help,

Upvotes: 0

David_Jiang
David_Jiang

Reputation: 73

Maybe the path is too long. Try this:

  1. Jenkins --> Project --> Project Configuration --> Build

  2. Select advanced option

  3. Check the option box "Force GRADLE_USER_HOME to use workspace" enter image description here

  4. Build your project

I solved my problem by this way, good luck!

Upvotes: 2

Bipin
Bipin

Reputation: 352

you can solve this by separating into smaller group of task make separate invoke gradle script under build tab

  1. clean build assembleDebug
  2. test
  3. connectedAndroidTest

i had similar issues, when i ran assembleDebug and test together in Jenkins as a single task

Upvotes: 0

Izabela Orlowska
Izabela Orlowska

Reputation: 7532

Try updating your android gradle plugin version to 3.2.0-alpha12 or newer. AAPT2's version included in these versions contains many fixes for path support on Windows which resulted in similar errors.

Upvotes: 0

Related Questions