在 Jenkins 上构建项目时,任务 ':app:mergeDebugResources' 执行失败
Execution failed for task ':app:mergeDebugResources' when building project on Jenkins
我正在尝试使用 jenkins 构建 Android 应用程序,但每次尝试时都会出现 "Execution failed for task ':app:mergeDebugResources'" 错误。
我看到问题可能是路径太大,因此 AAPT2 显示错误。我尝试移动我的项目目录并在我的构建 gradle 上添加 "multiDexEnabled true" 但似乎没有任何效果
Gradle版本:
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
这是我的作品gradle
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 构建项目时遇到的错误
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.1e8dd75caf52c41c02aeae6cef700c6a\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.1e8dd75caf52c41c02aeae6cef700c6a\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.1e8dd75caf52c41c02aeae6cef700c6a\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.1e8dd75caf52c41c02aeae6cef700c6a\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.1e8dd75caf52c41c02aeae6cef700c6a\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.1e8dd75caf52c41c02aeae6cef700c6a\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.1e8dd75caf52c41c02aeae6cef700c6a\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.1e8dd75caf52c41c02aeae6cef700c6a\res\drawable-hdpi-v4\abc_textfield_search_default_mtrl_alpha.9.png: error: file not found.
运行 从您的 jenkins 终端执行命令。
gradlew clean
gradle assembleDebug
如果以上命令不起作用,则删除 gradle 文件夹。
rm -rf C:\Windows\System32\config\systemprofile\.gradle
然后使用命令构建
gradle assembleDebug
我正在尝试使用 jenkins 构建 Android 应用程序,但每次尝试时都会出现 "Execution failed for task ':app:mergeDebugResources'" 错误。
我看到问题可能是路径太大,因此 AAPT2 显示错误。我尝试移动我的项目目录并在我的构建 gradle 上添加 "multiDexEnabled true" 但似乎没有任何效果
Gradle版本:
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
这是我的作品gradle
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 构建项目时遇到的错误
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.1e8dd75caf52c41c02aeae6cef700c6a\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.1e8dd75caf52c41c02aeae6cef700c6a\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.1e8dd75caf52c41c02aeae6cef700c6a\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.1e8dd75caf52c41c02aeae6cef700c6a\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.1e8dd75caf52c41c02aeae6cef700c6a\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.1e8dd75caf52c41c02aeae6cef700c6a\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.1e8dd75caf52c41c02aeae6cef700c6a\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.1e8dd75caf52c41c02aeae6cef700c6a\res\drawable-hdpi-v4\abc_textfield_search_default_mtrl_alpha.9.png: error: file not found.
运行 从您的 jenkins 终端执行命令。
gradlew clean
gradle assembleDebug
如果以上命令不起作用,则删除 gradle 文件夹。
rm -rf C:\Windows\System32\config\systemprofile\.gradle
然后使用命令构建
gradle assembleDebug