Android resource compilation failed
E:\VectorAssetDemo\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:157:
error: invalid color.
E:\VectorAssetDemo\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:
error: file failed to compile.
I have tried nothing.
no debuggable process
I was trying to use vector asset in an ImageView and I was also trying to implement colors on them.
A color in values.xml needs to follow this format.
<color name="theColorName">#000000</color>
I'm getting the following error when compiling in Android Studio
Android resource compilation failed
Output: error: found an invalid color.
The image that is causing the error is already a .9.png file and it looks like this in Android Studio
I am not sure how to solve this. I referred to this two questions
How can I track down the cause of Android "found an invalid color" error
Android : 9-Patch image Error
and both indicate that the border around the image should be transparent. I'm guessing I have to fix the "bad patches" shown in red. if that's the case how can I fix them and make the compilation succeed?
This is the output of my gradle console please help me out to solve this error, I am unable to build my project
Information:Gradle tasks [:facebook:generateDebugSources, :facebook:mockableAndroidJar, :facebook:prepareDebugUnitTestDependencies, :facebook:generateDebugAndroidTestSources, :lagaiKhai:generateDebugSources, :lagaiKhai:mockableAndroidJar, :lagaiKhai:prepareDebugUnitTestDependencies, :lagaiKhai:generateDebugAndroidTestSources]
Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
Error:Execution failed for task ':lagaiKhai:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
Information:BUILD FAILED
Information:Total time: 23.24 secs
Information:2 errors
Information:0 warnings
Information:See complete output in console
I once accidently added .gif file in drawable folder, and faced this issue, if you find any unwanted file in drawable foalder.
Follow the following steps:-
Remove all such files which are not recognised by drawable foalder (.gif, 9-patch, etc).
Close android studio and start it again
Clean and build project again
You are good to go again!
A temporary solution is to place the code below in the module build.gradle:
android {
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
}
And Sync the Project.Works for me.`
Try checking all the recentenly added 9patch files. they all must have the content markers on the 4 sides of the image
I created a 9-Patch file according to https://developer.android.com/studio/write/draw9patch.html, as a result of that, I faced the same error.
I had drew just the parts I wanted to stretch, but not the entire line.
To fix it I drew the entire right and bottom lines of the 9-patch, and the parts I wanted to stretch I did it on the left and top lines.
I used the Invalidate Cache and Restart Invalidate Cache and Restart option in android studio and it worked for me.
most of the time is a corrupt PNG image added recently to the project which cause this error. Check the git log and replace the file.
Sometimes menu : File > InvalidateCaches/Restart also helps
The problem is due to the .9 patch image file which you have added in the drawable.
To fix the issue.
1) Check you have named the 9 patch image as(file_name.png to file_name.9.png). E.g: "myimage.9.png" in the drawable folder.
2) Must Ensure that the 9 patch image file contains the "Content Marker on the 4 sides of the image". (i.e: if you open the image in Android studio, you will able to view 4 black lines on 4 sides of the image.)
3) if you not able to view the Content Marker on the sides of the image, then kindly rename the image file from (file_name.9.png to file_name.png), the error will be vanished.
I'm running Ubuntu 12.04 LTS and get the following error when building the example Android Studio example:
Gradle: Execution failed for task ':MyApplication:mergeDebugResources'.
Error: Failed to run command:
/home/dean/android-studio/sdk/build-tools/android-4.3.1/aapt s -i /home/dean/AndroidStudioProjects/MyApplicationProject/MyApplication/build/exploded-bundles/ComAndroidSupportAppcompatV71800.aar/res/drawable-xhdpi/abc_ic_search.png -o /home/dean/AndroidStudioProjects/MyApplicationProject/MyApplication/build/res/all/debug/drawable-xhdpi/abc_ic_search.png
Error Code:
132
It looks like I'm missing some resource.
There seems to be an issue with aapt on some 32 bit systems. It throws an error 132 on app:processDebugResources which is when aapt is 'crunching' png files ready for inclusion in the apk package. You can see more details at https://code.google.com/p/android/issues/detail?id=75110
This agrees with your reported error - "aapt -s" is the command to crunch a single image file (in your case abc_ic_search.png).
Some people have reported that 'fixing' the offending png files (e.g. by opening in Gimp and saving) sorts the problem so that would be worth trying at least. There's clearly a deeper problem with aapt but that may get you going for now.
Also can you just say if you are indeed running on a 32 bit processor, and if so which one? You can use lscpu to find out.
So im trying to save an image in one of the drawable folders in my android problem but no matter where i put the image file, trying to build or run my program gives this error
C:\Users\*****\AppData\Local\Android\android-sdk\tools\ant\build.xml:621: The following error occurred while executing this line:
C:\Users\******\AppData\Local\Android\android-sdk\tools\ant\build.xml:657: null returned: 1
the offending lines of code are:
621-elseText="hasCode = false. Skipping aidl/renderscript/R.java">
657-proguardFile="${out.absolute.dir}/proguard.txt">
As soon as i remove the image file my application cleans and builds and runs with no problems. What am i doing wrong?
Upper case letters are not allowed in resource file names. Did you verify?