我正在尝试使用jenkins构建Android应用程序,但每次尝试时,都会收到“任务':app:mergeDebugResources'执行失败”的错误。
我看到问题可能出在路径太大,因此AAPT2显示错误。我尝试移动项目目录并在构建gradle上添加“ multiDexEnabled true”,但似乎没有任何作用
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构建项目时遇到的错误
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.
答案 0 :(得分:0)
从jenkins终端运行以下命令。
IF (_flagContar=1) THEN
SELECT
COUNT(*) AS total
FROM
(
SELECT persona FROM mae_persona WHERE numerodocumento=_buscar LIMIT 50
UNION
SELECT persona FROM mae_persona WHERE nombrecompleto LIKE CONCAT(_buscar,'%') LIMIT 50) AS q;
ELSE
SET @rownum=0;
SELECT
@rownum:=@rownum+1 AS rownum,
persona,nombrecompleto,direccion,email
FROM
(
SELECT
persona,nombrecompleto,direccion,email
FROM
(
SELECT persona,nombrecompleto,direccion,email
FROM mae_persona WHERE numerodocumento=_buscar LIMIT 50
UNION
SELECT persona,nombrecompleto,direccion,email
FROM mae_persona WHERE nombrecompleto LIKE CONCAT(_buscar,'%') order by nombrecompleto LIMIT 50) AS q
) AS p
HAVING rownum > _reg_por_pag * (_pagina-1)
AND rownum <= _reg_por_pag * _pagina
ORDER BY rownum;
END IF;
END ;;
DELIMITER ;
如果以上命令不起作用,则删除gradle文件夹。
gradlew clean
gradle assembleDebug
然后使用命令进行构建
rm -rf C:\Windows\System32\config\systemprofile\.gradle