0
votes
AAPT err(Facade for 1340746194): \\? 
\C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0- 
 beta01.aar\01ea746f5d966b5b6980a3ad201cbcd2\res\drawable-xxhdpi-v4\abc_switch_track_mtrl_alpha.9.png ERROR: Unable to open PNG file
 AAPT err(Facade for 1340746194): \\?\C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0-beta01.aar\01ea746f5d966b5b6980a3ad201cbcd2\res\drawable-mdpi-v4\abc_textfield_activated_mtrl_alpha.9.png ERROR: Unable to open PNG file

Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT error: check logs for details :app:mergeReleaseResources FAILED

FAILURE: Build failed with an exception.

  • What went wrong:

    Execution failed for task ':app:mergeReleaseResources'. Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT error: check logs for details

Tried everything

android.enableAapt2=false
android.enableBuildCache=false in gradle properties. aaptOptions { cruncherEnabled = false }

still failing

2
If it gives aapt error, the problem is probably under resource folder. It gives a clue about a png file, could it be the problem? - Faruk Yazici
drawable-mdpi-v4\abc_textfield_activated_mtrl_alpha.9.png check this image or replace then run it again - Hemant Parmar
@faruk and hemat it is working fine on local actually build fails on jenkins server only - Piyush Kumar
@PiyushKumar that's right, you will not have a problem on local builds. I had a similar issue too. I had an html page in my res folder, and could build and run it successfully. However, release build did not allow this. I had to remove the html file. I believe this is a similar issue only happening on release build. - Faruk Yazici

2 Answers

0
votes

if it gives aapt error it means error in resources not in your code make sure you using PNG file .

also convert your png file from here and Check this link put it in your project and try again hope your prob will solve

0
votes

you can solve this by separating into smaller group of task

  1. build assembleDebug
  2. test
  3. connectedAndroidTest

i had similar issues, when i ran assembleDebug and test together in Jenkins as a single task