AAPT2 aapt2-3.2.1-4818971-windows Daemon #0 - android

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

Related

Aapt2 issue with jenkins build 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.

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?

React Native build error duplicate key on values.xml between different dependencies

I'm already search several information related to this issue. When I use com.midtrans:uikit:1.21.2 and :react-native-camera then run the build script, this error occurred.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
Output: /rootProject/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:492: error: duplicate value for resource 'attr/aspectRatio' with config ''.
/rootProject/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:492: error: resource previously defined here.
Command: /userRoot/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/26099ef957fce779fbc384e01d71f8d6/aapt2-3.2.1-4818971-osx/aapt2 compile --legacy \
-o \
/rootProject/android/app/build/intermediates/res/merged/debug \
/rootProject/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-osx Daemon #0
Output: /userRoot/.gradle/caches/transforms-1/files-1.1/cardview-v7-26.1.0.aar/f44a4b5427df6e671eadd76860228e04/res/values/values.xml:7:5-685: AAPT: error: duplicate value for resource 'attr/aspectRatio' with config ''.
/userRoot/.gradle/caches/transforms-1/files-1.1/cardview-v7-26.1.0.aar/f44a4b5427df6e671eadd76860228e04/res/values/values.xml:7:5-685: AAPT: error: resource previously defined here.
Command: /userRoot/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/26099ef957fce779fbc384e01d71f8d6/aapt2-3.2.1-4818971-osx/aapt2 compile --legacy \
-o \
/rootProject/android/app/build/intermediates/res/merged/debug \
/rootProject/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-osx Daemon #0
This error is refers to this line on rootProject/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml
Then i found that if there are multiple key with the same value.
react-native-camera resources on android/src/main/res/value/attrs.xml with key <attr format="string" name="aspectRatio"/>
com.midtrans:uikit resources on uikit/src/main/res/value/attrs.xml with key <attr format="float" name="aspectRatio"/>
I need help to fix this error, or any information to fix/avoid this situation.
There are some thread that I checked.
React Native : Error: Duplicate resources - Android
Unable to build android (because of duplicate dependecies ?)
React Native Error: Duplicate resources, assets coming in some screens and not coming in others in android release APK
Any help would be thanks.
Few solution you might interested to:
Fork the react-native-camera in GitHub to yours and modify the styles.xml and attrs.xml and add it to your react native project.
Use the other's forked project from com.midtrans in here. Veritrans has clearly stated that they won't support react-native project and might not merge this pull request.
I will recommend the solution no 1. I have forked and modify the resource value and some modification on others to follow my requirement needs. Feel free to take a look: here

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

Categories

Resources