Android studio build.9.png format error

This is the error log:

Error:Execution failed for task ':MobileSafe2:mergeDebugResources'.
Crunching Cruncher call_locate_blue.9.png failed, see logs

But when I turn the extension .9.pnginto .png, the error disappears, I do not know why this is happening.

This is the code:

    public void myToast(String address) {
        View view = View.inflate(context, R.layout.address_show, null);
        view.setBackgroundResource(**R.drawable.call_locate_blue**);

        TextView textView = (TextView) view.findViewById(R.id.tv_address);
        textView.setText(address);

        WindowManager.LayoutParams params = new WindowManager.LayoutParams();

        params.height = WindowManager.LayoutParams.WRAP_CONTENT;
        params.width = WindowManager.LayoutParams.WRAP_CONTENT;

        params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
                | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
        params.format = PixelFormat.TRANSLUCENT;
        params.type = WindowManager.LayoutParams.TYPE_TOAST;
        wm.addView(view, params);
    }​

This is in Android Studio enter image description here

Error Information: enter image description here

I need to fix '.9.png' in '.png', then it may work, but the image will be distorted

+4
source share
4 answers

As far as I can see, you didn’t 9 patch markers.
They are needed to turn png into 9.png (correctly said 9 patch ).

, IDE - , ", 9 : ".

, , , .

9 : http://blog.booleanbites.com/2012/11/android-how-to-use-9-patch-png.html

+5

.9.png, Android Studio , 9 . , .

0

I had the same problem. I had to first open the image in Android Studio and set the borders of the image to stretch. There should be a line at the edge of the image telling her how to stretch. In the Android studio, they simplified the setup. If you click the "Show Content" button, you will see how the image will be stretched. For me, it was SUPER useful in creating chats.

0
source

Try refactoring the file and rename it to filename.9.png

0
source

All Articles