Compilation is getting failed due to error 157 - android

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>

Related

How can I resolve the Android Studio Build Output error

Trying to build the app but have got the error: The error Confugure image asset1
Confugure image asset2
Confugure image asset3
ERROR:C:\Users\Alex\AndroidStudioProjects\Lm2\app\src\main\res\mipmap-anydpi-v26\ic_launcher_round.xml:3: AAPT: error: resource mipmap/ic_launcher_background (aka com.example.lm2:mipmap/ic_launcher_background) not found.
How can I resolve this?
I hope you have
put your launcher icons into the mipmap folder where they should always go.
added your adaptive icon to the app’s manifest.xml for “android:icon” (android:roundIcon) attribute
.
Fist hand try: Clean your project and Rebuild
Probable Issue reason: Malformed XML:
Solution:
Check if you have anything duplicated by mistake in your XML
Try Analyze > Inspect Code it will redirect you to the exact error.

resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found

When I want to try the application on the emulator or extract the .apk
I face this error
Android resource linking failed
error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
error: failed linking references.
I think your are applying that style wrong.
Try to set the style of your view in your layout (.xml file) this way:
style="#style/TextAppearance.Material.Widget.Button.Borderless.Colored"
Let me know if that helped!

Invalid color in Android Compilation. How to fix .9.png

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?

Error at a compile time with 9.png

I have two 9.png images created with the generator Nine Patches. When I run the app Android Studio stops and say me that the images have an error on the pixel #394. What is the problem??
These are the images.
The error in the log:
Error:Execution failed for task ':app:mergeDebugResources'.
> Error: Failed to run command:
C:\Program Files (x86)\Android\android-studio\sdk\build-tools\android-4.4.2\aapt.exe s -i D:\Users\McFly\AndroidStudioProjects\Syncro\app\src\main\res\drawable-xxhdpi\spinner_line.9.png -o D:\Users\McFly\AndroidStudioProjects\Syncro\app\build\res\all\debug\drawable-xxhdpi\spinner_line.9.png
Error Code:
42
Output:
ERROR: 9-patch image D:\Users\McFly\AndroidStudioProjects\Syncro\app\src\main\res\drawable-xxhdpi\spinner_line.9.png malformed.
Frame pixels must be either solid or transparent (not intermediate alphas).
Found at pixel #364 along top edge.
Rename the file to example.png rather than example.9.png. I had same issue in past and renaming helped me.

Gradle , Unsupported type in xml

I have a xml file. dimens.xml. There I have an entry like
<item name="attr_name" format="float" type="vals">1.0</item>
However when I try to run gradle build, gradle gives an error 'Execution failed for task ':mergeDebugResources'. Unsupported type 'vals'
I am fetching the value as context.getResources().getValue(R.vals.store_list_view_width_ratio...
How do I tackle this so that gradle does not give any error. Also I removed the type attribute, then gradle started saying unknown type 'item'
What should be done?
vals is not valid. Use type="dimen" and R.dimen...
Reference: https://stackoverflow.com/a/20120240/2649012

Categories

Resources