Aapt2 issue with jenkins build Android - android

I'm using Jenkins to build my android application. I have an issue with Aapt2 when I'm trying to build task "assemble".
I have added the android.enableAapt2 = true but I still have the issue.
Error :
Execution failed for task ':app:mergeDebugResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
Output: C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\9b13819df5a46cfa71ada9be5d91c322\res\layout\abc_search_dropdown_item_icons_2line.xml: error: file not found.
Command: C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\bc9c8887a50f76d929803eb5bfe61459\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
-o \
D:\jenkins\workspace\DemoProject\app\build\intermediates\res\merged\debug \
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\9b13819df5a46cfa71ada9be5d91c322\res\layout\abc_search_dropdown_item_icons_2line.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #2

Looks like aapt2 is having trouble parsing the file path (it's too long). You can either try upgrading to the newest android gradle plugin which has better support for long paths, or you can try moving your gradle cache closer to the C: root.

Related

Error building android project with gradle using teamcity

Using team city to build and android app. keep getting an error.
[16:59:38] [Step 1/1] Execution failed for task
':app:mergeDebugResources'. org.gradle.internal.UncheckedException:
java.util.concurrent.ExecutionException:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource
compilation failed Output:
C:\Windows\System32\config\systemprofile.gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0.aar\3467ebf6f9d1bb66db4bdb226db55512\res\drawable-hdpi-v4\abc_ic_menu_share_mtrl_alpha.png:
error: file not found.
Command:
C:\Windows\System32\config\systemprofile.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\8a1ce91548f2547bb27874a553d3981d\aapt2-3.2.1-4818971-windows\aapt2.exe
compile --no-crunch \
--legacy \
-o \
C:\TeamCity\buildAgent\work\7028d0f31da34ed0\Workshop\app\build\intermediates\res\merged\debug
\
C:\Windows\System32\config\systemprofile.gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0.aar\3467ebf6f9d1bb66db4bdb226db55512\res\drawable-hdpi-v4\abc_ic_menu_share_mtrl_alpha.png
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #1
The file it says it can't find is definitely there. I'm a .net developer with hardly any experience of android development so I have no idea what to look at next in order to fix this. please help.
AAPT2 still seems to have some trouble with long paths on Windows. Try moving your gradle cache closer to C:\ to shorten the file path.
Here's an answer on how to change the cache location: How to set gradle cache location?

AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

I am really stuck with this error and i read out same question and Apply solution but not solve my Error
So Please help me out this
Thanks in Advance
This is error
Android resource compilation failed
Output: C:\Projects\sample_2.0\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:211: error: invalid color.
Command: C:\Users\SABC\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\81098111cca13a00241e3b8da7bcb924\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
-o \
C:\Projects\sample_2.0\app\build\intermediates\res\merged\debug \
C:\Projects\sample_2.0\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
I had the same issue, but for another resource. Maybe it was because I used AndroidX libraries. Anyway try to clean gradle cache, it was successful solution in my case. Just remove directory: C:\Users\{username}\.gradle\caches\transforms-1

Android resource compilation failed when opening a new project in android studio

I have this error when opening new project with my android studio
Android resource compilation failed Output: C:\Projects\Popular2\app\src\main\res\drawable-v24\ic_launcher_foreground.xml:1: error: not well-formed (invalid token).
Command: C:\Users\Personal.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\e2bfab9f446f5b6bef325bd9d21fcd8e\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy -o C:\Projects\Popular2\app\build\intermediates\res\merged\debug
C:\Projects\Popular2\app\src\main\res\drawable-v24\ic_launcher_foreground.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #1
I have tried to clean and rebuild the app but didn't help!
Any help ?
You should :
Go to your project location
delete the drawable-v24 folder.
delete the mipmap-anydpi-v26 if exist.
rebuild your project.

Jenkins Execution failed for task ':app:mergeDebugResources' , file not found

I have been trying to build an Android application using Jenkins. I am getting Jenkins Execution failed for task :app:mergeDebugResources. I do have admin privilege but console output saying file not found. I have attached console output for reference. Please help.
Execution failed for task ':app:mergeDebugResources'.
java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
Output: C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0-alpha3.aar\6bb4f54973fdd09ea38bd7415ec1d0d5\res\layout\abc_action_bar_up_container.xml: error: file not found.
Command: C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-alpha11-4662957-windows.jar\67f4bb4ae3aea8a18831d06eb5615105\aapt2-3.2.0-alpha11-4662957-windows\aapt2.exe compile --legacy \
-o \
C:\Program Files (x86)\Jenkins\workspace\haha\app\build\intermediates\res\merged\debug \
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0-alpha3.aar\6bb4f54973fdd09ea38bd7415ec1d0d5\res\layout\abc_action_bar_up_container.xml
Fix by not using System32 as a cache. From this question there are two solutions to this:
Set the GRADLE_USER_HOME environmental variable
Add -g C:\*some dir* to the command
Facing this issue with Jenkins in windows, I fixed this issue by setting Environmental variable to Gradle as fixed my issue.
GRADLE_USER_HOME as C:/gradle-cache

Non-specific Error in Android studio 3.0 Beta 2

I can't continue building my app, because I updated Android studio to 3.0 beta 2 and I got this error message:
Error:C:\Users\Luk?\.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.0.1.aar\f61ab9a130e23c5f88348e1bd6936dcf\res\drawable-xhdpi-v4\abc_ic_menu_copy_mtrl_am_alpha.png file not found
Error:C:\Users\Luk?\.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.0.1.aar\f61ab9a130e23c5f88348e1bd6936dcf\res\drawable-hdpi-v4\abc_btn_radio_to_on_mtrl_000.png file not found
Error:C:\Users\Luk?\.gradle\caches\transforms-1\files-1.1\support-compat-26.0.1.aar\62d1a0a0753b75c4dfbf8fbe3e7715ba\res\drawable-xhdpi-v4\notify_panel_notification_icon_bg.png file not found
Error:Execution failed for task ':app:mergeDebugResources'.
Error: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed:
aapt2 compile --legacy -o C:\AndroidApp\app_name\app\build\intermediates\res\merged\debug C:\Users\my_name.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.0.1.aar\f61ab9a130e23c5f88348e1bd6936dcf\res\layout\tooltip.xml
Issues:
- ERROR: C:\Users\my_name.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.0.1.aar\f61ab9a130e23c5f88348e1bd6936dcf\res\layout\tooltip.xml file not found
Try disabling the AAPT2 by adding android.enableAapt2=false to your gradle.properties file.
If you want to build the project with aapt2 enabled the follow the below link for changes in project and to get to how fix the error.
Reference : here
I was using Android studio 3.0.1 In which I disabled the AAPT2 and it resolved my error.

Categories

Resources