Skip to content

Display differences due to file sorting in Android APK files, e.g. resources.arsc

This bug was originally reported by Torsten Grote (t@grobox.de) in Debian bug #901956:

When comparing two APK files with diffoscope, it only shows a difference
in the CRC checksum of the resources.arsc file, but fails to provide a
better idea about why the files are different.

In this case, the difference seems to comes from file sorting that
affects how resources.arsc is created. That is most likely why also
apktool does not show any differences.

The only way I could show better differences was running `aapt dump
resources` on the APKs.

Two example files for comparision:
https://salsa.debian.org/lamby/trydiffoscope/uploads/8f0119e1d92586e214bb470bfdd73a8a/briar-1.0.4.apk
https://salsa.debian.org/lamby/trydiffoscope/uploads/7778c840abbcc815b8c24d6bc0a7f316/briar-1.0.4-built.apk

Upstream issue: https://issuetracker.google.com/issues/110237303

Diffoscope output:

--- briar-1.0.4.apk
+++ briar-1.0.4-built.apk
├── zipinfo -v {}
│ @@ -35864,15 +35864,15 @@
│    version of encoding software:                   1.0
│    minimum file system compatibility required:     MS-DOS, OS/2 or NT FAT
│    minimum software version required to extract:   1.0
│    compression method:                             none (stored)
│    file security status:                           not encrypted
│    extended local header:                          no
│    file last modified on (DOS date/time):          1980 000 0 00:00:00
│ -  32-bit CRC value (hex):                         0ee390c7
│ +  32-bit CRC value (hex):                         ddba3b9c
│    compressed size:                                1115900 bytes
│    uncompressed size:                              1115900 bytes
│    length of filename:                             14 characters
│    length of extra field:                          0 bytes
│    length of file comment:                         0 characters
│    disk number on which file begins:               disk 1
│    apparent file type:                             binary
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information