Aapt Remove Command error during crunch – archive is toast

To package APK these days, you need to use the AAPT command to remove the old certificate file in APK, add a new certificate file again, and then sign and repackage again. It is found that when using the AAPT remove command, the error during crash – archive is toast is always reported. After a day’s comparison, it is found that it is related to the referenced com.android.tools.build: gradle: 4.1.1 and gradle-6.5-bin versions. As long as it is equal to or greater than this version, this error will be reported, which should be a bug of AAPT.

Solution:

1. The gradle plug-in is lower than these two versions. It’s unrealistic. It’s impossible not to upgrade it all the time.

2. Since APK is essentially a zip file, simply when deleting the file, open the APK package directly with the zip decompression software, manually delete the ball, and complete the remaining AAPT add command and re signature operation with the command line.

Read More: