How to fix PNG error on Apktool

I got a strange PNG error when trying to compile

I: Using Apktool 2.5.0
I: Smaling smali folder into classes.dex...
I: Smaling smali_classes2 folder into classes2.dex...
I: Smaling smali_classes3 folder into classes3.dex...
I: Smaling smali_classes4 folder into classes4.dex...
I: Smaling smali_classes5 folder into classes5.dex...
I: Building resources...
W: libpng error: Not a PNG file
W: ERROR: Failure processing PNG image E:\APK Easy Tool\1-Decompiled APKs\gameexample\res\mipmap\ic_launcher_background.png
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1):

We can see an error occured on \gameexample\res\mipmap\ic_launcher_background.png

How to solve it? Basically use any image editing software that support transparent like Photoshop, and just re-save the PNG file, then it will successfully compile the APK

I: Using Apktool 2.5.0
I: Smaling smali folder into classes.dex...
I: Smaling smali_classes2 folder into classes2.dex...
I: Smaling smali_classes3 folder into classes3.dex...
I: Smaling smali_classes4 folder into classes4.dex...
I: Smaling smali_classes5 folder into classes5.dex...
I: Building resources...
I: Copying libs... (/lib)
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk...

The same as PNG signature error:

Using Apktool 2.7.0
Smaling smali folder into classes.dex...
Smaling smali_classes2 folder into classes2.dex...
Building resources...
D:\Temp\ATG\pnxAI\dec\res\drawable\icon.png: error: failed to read PNG signature: file does not start with PNG signature.
D:\Temp\ATG\pnxAI\dec\res\drawable\icon.png: error: file failed to compile.
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\XXX\AppData\Local\Temp\brut_util_Jar_123565648727517547025873579935480005205.tmp, compile, --dir, D:\Temp\ATG\pnxAI\dec\res, --legacy, -o, D:\Temp\ATG\pnxAI\dec\build\resources.zip]

Once again, re-save the PNG file located on \res\drawable\icon.png, then it will successfully compile the APK

Using Apktool 2.7.0
Smaling smali folder into classes.dex...
Smaling smali_classes2 folder into classes2.dex...
Building resources...
Copying libs... (/lib)
Copying libs... (/kotlin)
Building apk file...
Copying unknown files/dir...
Built apk into: D:\Temp\ATG\pnxAI\dec.apk
Compiling successfully completed. Output directory "D:\Temp\ATG\pnxAI\dec.apk"

Comments

Popular Posts

VMOS Pro - FREE Custom ROMs without VIP | GMS, ROOT, Xposed | Android 4.4.4, 5.1.1, 7.1.2, 9.0 ROMs

List of Android Virtual Machine apps for Android devices