Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

9patch AAPT: error: file failed to compile

I'm trying to work with a 9patch image format but I get this error when I try to build the app:

AAPT: error: file failed to compile

Any reasons why this could happen?

like image 977
regev avraham Avatar asked Jan 04 '20 19:01

regev avraham


3 Answers

The reason that the 9patch failed to compile was 9patch bad format - the 9patch indicating pixels wasn't fully black (#000000) but some of them was grey, fixing those pixels to pure black fixed the problem

like image 56
regev avraham Avatar answered Nov 07 '22 13:11

regev avraham


Having opened the 9patch in an image editor while editing it at the same time in Android Studio can also cause this error, I guess its since AS can't write the 9patch file when compiling.

like image 1
SkeletorFromEterenia Avatar answered Nov 07 '22 15:11

SkeletorFromEterenia


For me this was because the top-left pixel was black instead of transparent.

like image 1
MarkWPiper Avatar answered Nov 07 '22 15:11

MarkWPiper