1

I'm working on an Android app which downloads new-updated resources from a remote server whose platform isn't specified yet.

The app compares the size of the pre-downloaded local file and the remote file from the server which is a terrible idea.

I just heard that the size of a file can be different depending on the platform the file lies on, to my surprise.

https://askubuntu.com/q/341143

So, question:

Is an identical file expected to be the same in size in all across the Android devices?

  • 2
    That doesn't depend much on the platform, but rather on the file system: depending on block size, the same amount of data might consume a different amount of disk space. BUT: Development questions are off-topic here, please see our help center. – Izzy Oct 26 '15 at 11:02
  • Thank you for the answer and pointing that out, @Izzy. I'll keep in mind. – Attacktive Oct 26 '15 at 13:05
  • 1
    "Data size" and "file size" are different things. Files are arbitrary concepts and can take up much more space than the data that they represent. – Matthew Read Nov 2 '15 at 17:45
2

Yes. If the files are identical, by definition, they should also be identical in size, regardless of platform (Unless the file is a sparse file, and/or the mechanism by which the FS driver of the platform reports file sizes is buggy).

But for identical apps, however:

Not necessarily. The file size mostly differs for native-compiled executable code (ARM vs. x86 chipsets,etc.), graphics resources supplied as per the device's graphics capability (OpenGL ES 2.0 vs 3.0), and so on.

In your case, it would be better to compute and compare checksums for the files, instead of size, as they depend on the contents of the file which should not vary from platform to platform, except as stated above.

|improve this answer|||||
  • Ahh, yes. We should've thought of checksumming earlier. Thank you so much! – Attacktive Oct 26 '15 at 12:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.