简体   繁体   中英

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.

  • What went wrong: Execution failed for task ':app:mergeDebugResources'.

    Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details

  • 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.

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

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

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" 在此处输入图片说明

  4. Build your project

I solved my problem by this way, good luck!

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.

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

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,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM