On Android we cant use DRAWRECT and other commands. Its might fails on some devices and this will NOT been fixed at all. Its impossible.
But we can use POLYVECTOR, which works fine on Android. Here is a possible work around:
GLOBAL IS24BIT=FALSE // FALSE ON ANDROID, TRUE ON OTHER PLATFORMS).
FUNCTION PaintColorRectRGB_START: imageID
IF IS24BIT=TRUE THEN RETURN
LOCAL ww, hh
GETSPRITESIZE imageID, ww, hh
IF ww=0 THEN RETURN
STARTPOLY imageID, 2;
ENDFUNCTION
FUNCTION PaintColorRectRGB: x, y, w, h, rr%, gg%, bb%, id=0
//IF x>ScreenWidth THEN RETURN
//IF y>ScreenHeight THEN RETURN
IF IS24BIT=FALSE
rr=INTEGER(rr/16)
gg=INTEGER(gg/16)
bb=INTEGER(bb/16)
LOCAL xx%=rr*64+gg*4
LOCAL yy%=bb*4
IF xx>512
xx=xx-512
yy=yy+64
ENDIF
xx=xx*2+1
yy=yy*2+1
IF xx>512
xx=xx-512
yy=yy+256
ENDIF
POLYVECTOR x, y, xx+1, yy
POLYVECTOR x, y+h, xx+1, yy+1
POLYVECTOR x+w, y, xx+1, yy
POLYVECTOR x+w, y+h, xx+1, yy+1
POLYNEWSTRIP
ELSE
DRAWRECT x, y, w, h, RGB(rr, gg, bb)
ENDIF
ENDFUNCTION
FUNCTION PaintColorRectRGB_END:
IF IS24BIT=TRUE THEN RETURN
ENDPOLY
ENDFUNCTION
This code can been little bit slower, but better alternative.
This code was used in CatchOut to avoid DRAWRECT on Android, which can fails on some devices and even crash out.
The limit here is you can only use a palette from 4096 colors.