JusticeRage / ApkTrack

ApkTrack is an Android app which checks if updates for installed APKs are available.
GNU General Public License v3.0
122 stars 27 forks source link

ApkTrack considers that an X.11.Y release is older than a X.6 release #97

Closed danaelg closed 6 years ago

danaelg commented 7 years ago

Hello Thank you for this app it's very useful ! I just found an issue. I have a game in a old 6.2 release and there is now a newest release 6.11.1 As you can see on the screenshot, ApkTrack think my release is the newest (but it's not) screenshot_2016-12-30-11-33-38

I'm sorry about my English

JusticeRage commented 7 years ago

Hi! Thanks for reporting this. I've looked at the code again (it's at model/InstalledApp.java:395), and you're falling into one of the edge cases of version comparison. Let me explain in more detail.

First of all, comparing version numbers is hard. There is no standard versioning scheme for all apps, and every developer hos their own way of doing things. In order to make sense of all of it, ApkTrack has to make some assumptions. One of them is that app versions are somewhat consistent over time. For instance, it will always follow a scheme such as X.Y.Z, or A-B.C,D. It doesn't matter too much what it is, as long as it doesn't change. ApkTrack then splits the app version into tokens (X, Y and Z or A, B, C and D in these examples) and compares them with the new version number to detect which one is the newest. In your case however, the scheme has changed: 6.2 is X.Y, whereas 6.11.1 is X.Y.Z and the app has no idea how to compare these reliably. This is why it falls back to a simple alphabetical comparison, which would have worked in most cases (6.2 < 6.8.2 for instance), but in this particular case, you're unlucky because 11 < 2 in alphabetical order.

You'll have to update the app manually so ApkTrack can compare versions correctly again. Sorry about this, but I'm not sure there is a good way to fix the problem generically.

DJaeger commented 7 years ago

Why not always create a version of four parts and fill all missing parts with zeros? That should work in most cases.

JusticeRage commented 7 years ago

I'll make some tests.

ghost commented 7 years ago

I've noticed something similar with Ghost Commander from F-Droid (https://f-droid.org/repository/browse/?fdid=com.ghostsq.commander)

The current version there is 1.53.10b2 where the Google Play version is 1.53.9. ApkTrack sees 1.53.9 as a newer release then 1.53.10b2 so its not only X.Y vs. X.Y.Z but also X.Y vs. X.YY

JusticeRage commented 7 years ago

In this particular case, I would argue that comparing "9" and "10b2" alphabetically is the only thing that makes sense in the general case.