9patch AAPT: error: file failed to compile
Asked Answered
P

3

7

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?

Percheron answered 4/1, 2020 at 19:5 Comment(0)
P
6

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

Percheron answered 4/1, 2020 at 19:5 Comment(2)
mine are pure black or pure transparent. how can i get gradlew to give me more details?Pincince
This was the case for me too! I checked the black pixels, and turns out they were RGB(1,1,1) instead of RGB(0,0,0)Planchette
M
1

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.

Manolo answered 14/9, 2021 at 15:56 Comment(0)
G
1

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

Guyton answered 12/4, 2022 at 11:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.