简体   繁体   English

Cordova构建android:':app:mergeDebugResources'。 詹金斯失败

[英]Cordova build android:':app:mergeDebugResources'. failing in Jenkins

After updating the android studio, gradle version and Cordova (incl. platforms) for hybrid project in windows 10 recently, i got this error in Jenkins. 在最近为Windows 10中的混合项目更新android studio,gradle版本和Cordova(包括平台)后,我在Jenkins中得到了这个错误。

 :app:mergeDebugResourcesC:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.4.0.aar\76d6a769daf730ed767830374ebcd3bd\res\drawable\abc_btn_colored_material.xml: error: file not found.

  ...
  ...

 Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.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.tools.aapt2.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.

I searched for a solution for this which should be dynamical and can be managed through Jenkins itself since it is not possible to edit individual platform files. 我搜索了一个动态的解决方案,该解决方案应该是动态的,并且可以通过Jenkins本身进行管理,因为无法编辑单个平台文件。

Originally the error was 最初的错误是

 Execution failed for task ':mergeDebugResources'.
 > Error: com.android.builder.internal.aapt.AaptException: Failed to crunch file

which was caused by 这是由

Error: File path too long on windows, keep below 240 characters 错误:Windows上的文件路径过长,请保持240个字符以下

Workaround for this was to change workspace folder so it is coming to a top level. 解决此问题的方法是更改工作区文件夹,以便将其移到顶层。 (eg: C:/Users/[youruser]/yourfolder. Check the link here (例如:C:/ Users / [您的用户] /您的文件夹。在此处查看链接

Note I added this question and the answer, for the self reference in future and to assist someone who is working with Jenkins. 请注意, 我添加了这个问题和答案,以备将来参考,并为与Jenkins合作的人员提供帮助。

The answer is a simple tweak. 答案很简单。 Go to

Manage Jenkins --> Configure System --> Global Properties

add an Environment variable 添加一个环境变量

name = GRADLE_USER_HOME
value = C:\Users\[youruser]\devGradle

create a folder "devGradle" (or give it any name) if it is not created already. 如果尚未创建文件夹,则创建一个文件夹“ devGradle”(或给它命名)。

The Gradle build script will look for this environment variable and then use the specified directory as the Gradle home directory and will build the project Gradle构建脚本将查找此环境变量,然后使用指定的目录作为Gradle主目录并构建项目

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Jenkins Android build:app:mergeDebugResources问题 - Jenkins Android build :app:mergeDebugResources problem Cordova 为 android 构建失败 - Cordova build failing for android 科尔多瓦无法在Android上构建 - Cordova failing to build on android 离子应用程序 - Android 应用程序构建卡在 app:mergeDebugResources 上,没有错误 - Ionic App - Android app build getting stuck on app:mergeDebugResources with no error :app:mergeDebugResources FAILED Android - :app:mergeDebugResources FAILED Android 使用NativeScript Sidekick的Android构建错误:app:mergeDebugResources - Android build error using NativeScript Sidekick: app:mergeDebugResources 在应用程序阶段构建 android 错误:mergeDebugResources,ParseError AttributeNSNotUnique - Build android error at stage app:mergeDebugResources, ParseError AttributeNSNotUnique Jenkins的Cordova Android构建失败 - Jenkins fails Cordova Android build 无法构建Android APK-任务':app:mergeDebugResources'执行失败 - Unable to build Android APK - Execution failed for task ':app:mergeDebugResources' Android gradle构建突然在':app:mergeDebugResources'上失败,没有错误消息 - Android gradle build fails suddenly on ':app:mergeDebugResources' with no error messages
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM