遇到的APK可以正常反编译,打包时会出现如下错误:
I: Using Apktool 2.1.1
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building resources...
W: libpng error: Not a PNG file
W: ERROR: Failure processing PNG image res/drawable-hdpi-v4/btn_main_1_1.png
W: libpng error: Not a PNG file
W: ERROR: Failure processing PNG image res/drawable-xhdpi-v4/btn_main_1_1.png
W: libpng error: Not a PNG file
W: ERROR: Failure processing PNG image res/drawable-hdpi-v4/btn_main_1_2.png
W: libpng error: Not a PNG file
W: ERROR: Failure processing PNG image res/drawable-xhdpi-v4/btn_main_1_2.png
W: libpng error: Not a PNG file
W: ERROR: Failure processing PNG image res/drawable-hdpi-v4/btn_main_1_3.png
W: libpng error: Not a PNG file
W: ERROR: Failure processing PNG image res/drawable-xhdpi-v4/btn_main_1_3.png
W: libpng error: Not a PNG file
W: ERROR: Failure processing PNG image res/drawable-hdpi-v4/btn_main_1_4.png
W: libpng error: Not a PNG file
查看文件格式:
原来并不是png文件,将后缀名改为exif后便可重打包运行。
由于涉及到的png文件比较多,用下面这个命令可以批量修改:
grep "\.png" log.txt | awk '{fileName=substr($7,0,length($7)-3);system("mv "$7" "fileName".exif")}'