在Jenkins上构建项目时,任务':app:mergeDebugResources'的执行失败 [英] Execution failed for task ':app:mergeDebugResources' when building project on Jenkins

查看:430
本文介绍了在Jenkins上构建项目时,任务':app:mergeDebugResources'的执行失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用jenkins构建Android应用程序,但是每次尝试时,都会收到任务':app:mergeDebugResources'执行失败"的错误.

I'm trying to build an Android application with jenkins but I'm getting "Execution failed for task ':app:mergeDebugResources'" error each time I try it.

我看到问题可能出在路径太大,因此AAPT2显示错误.我尝试移动项目目录并在构建gradle上添加"multiDexEnabled true",但似乎没有任何作用

I saw that the problem could be that the path is too large and AAPT2 is displaying an error because of that. I tried moving the directory of my project and adding "multiDexEnabled true" on my build gradle but it seems that nothing of this works

Gradle版本:

dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
    }

这是我的构建包

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.calculator"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

这是我每次尝试使用Jenkins构建项目时遇到的错误

And this is the error I get each time I try to build my project with Jenkins

Execution failed for task ':app:mergeDebugResources'.
> 8 exceptions were raised by workers:
  com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
  C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\2e8dd75caf52c41c02aeae6cef700c6a\res\drawable-xxhdpi-v4\abc_text_select_handle_middle_mtrl_light.png: error: file not found.

  com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
  C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\2e8dd75caf52c41c02aeae6cef700c6a\res\layout\abc_action_bar_up_container.xml: error: file not found.

  com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
  C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\2e8dd75caf52c41c02aeae6cef700c6a\res\drawable-xhdpi-v4\abc_ab_share_pack_mtrl_alpha.9.png: error: file not found.

  com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
  C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\2e8dd75caf52c41c02aeae6cef700c6a\res\anim\abc_tooltip_exit.xml: error: file not found.

  com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
  C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\2e8dd75caf52c41c02aeae6cef700c6a\res\layout\abc_search_dropdown_item_icons_2line.xml: error: file not found.

  com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
  C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\2e8dd75caf52c41c02aeae6cef700c6a\res\drawable-hdpi-v4\abc_ic_menu_share_mtrl_alpha.png: error: file not found.

  com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
  C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\2e8dd75caf52c41c02aeae6cef700c6a\res\drawable\abc_btn_colored_material.xml: error: file not found.

  com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
  C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\2e8dd75caf52c41c02aeae6cef700c6a\res\drawable-hdpi-v4\abc_textfield_search_default_mtrl_alpha.9.png: error: file not found.

推荐答案

从jenkins终端运行以下命令.

Run following commands from your jenkins terminal.

    gradlew clean
    gradle assembleDebug

如果以上命令不起作用,则删除gradle文件夹.

If above command does not work, then delete gradle folder.

    rm -rf C:\Windows\System32\config\systemprofile\.gradle

然后使用命令进行构建

    gradle assembleDebug

这篇关于在Jenkins上构建项目时,任务':app:mergeDebugResources'的执行失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆