Possibilities to allow switching between built apks (downgrade)

Hi,

I have built a private fdroid repo to host an app I am building and I can install the app via this.
I want to be able to switch between versions once installed (both “upgrade” and “downgrade”).
This works when just installing the app from the filesystem. I believe this is because all versions of the app I am building are the same even though the package name/info shows the “correct” version.
In my repo I can see both versions but cannot install the other (as I assume fdroid is preventing this??)

Are there any suggestions to work around this or would my best bet be to try and change the fdroid code??

See below for what I mean - I was hoping to be able to switch between these two versions:

Thanks in advance!

Android itself (the OS) won’t let you downgrade apps. There’s nothing F-Droid can do about that.

Hi @TheLastProject - Sorry maybe I should have been clearer…
I know about the android limitation (can only upgrade or reinstall a package of the same version).

What the AAPS project has done to work around this (because downgrading from a dev version is important here) is to always keep the same version number, but it looks like the version name (not really sure what this is but the text in my screenshot) contains version info.

What I wanted to understand was why I couldnt install those other versions (that have the same version number) from fdroid yet I can install them manually no worries (as in “upgrade”/“downgrade”, not uninstall then reinstall).

Anyway I did find a workaround - I downloaded “Neo Store” and this allows me to install with the current one installed - See screenshot. Also note how the version number is the same (1500) in both (next screenshot)


F-Droid considers there’s nothing to be done since you already have the same version(Code) installed (eg. 1500). versionName (eg 3.1.0.2-whatever) does not matter.

This sounds like an edge case…

Thanks @Licaon_Kter - I agree it is an edge case, would there be any harm in allowing this from withing the fdroid app though?
Especially since the android OS allows this…

Here’s a thought, afaik, in a repo, apks are usually named as app.id_versionCode.apk, I guess not in yours? This would make the existence of a second APK in the repo impossible.

@Licaon_Kter In my repo the actual files are named differently to that and I cant see why that would be an issue?

What I need to be able to do is upgrade and downgrade a package without reinstalling the apk.
This is currently accomplished by keeping the version number the same (to work around android forcing you to only ever upgrade).

This all works for files on the filesystem, what I was wondering was if there was a reason why the fdroid client is blocking this?
I guess like you said on most repos this would never be possible, so should be fine to enable right?

Yeah I know thats what fdroid does (for my use case thats the issue), I was wondering if you would accept a PR to make it work like the “Neo store” fdroid front end?

Anyway no stress if not I guess it would just be helpful (and doesnt seem like it would cause any issues)…

Not sure an INSTALL button to reinstall the same version makes sense UI wise imho

Yeah fair point, maybe a “reinstall” button for that use case? We already have a downgrade button (although that doesnt seem to do anything??)

I was planning to nuke the downgrade button fyi :slight_smile:

Haha yeah fair enough - no point having it if it doesnt do anything!

Alternatively, maybe just bump the versionCode automatically every build? According to Version your app  |  Android Developers the max version code for Google Play is 2100000000 (no info on Android itself, possibly even higher) so I think you’d be unlikely to hit that ever if you just start at 1.

The issue is I need to be able to test a dev build of the app and be able to roll back easily to a known good version (without reinstalling).
The only way to do this I believe is to not change the version number at all. This works… its just when I try to present the app in my fdroid repo and open in the fdroid client I cant install (or upgrade/downgrade from the version I have installed).

BTW Im not really able to change the versioning of the app - its not really my place to change this (its open source, and you must build it yourself as it is a medical app, Im just trying to help people self host a repo that will ease some of this self building). Can take a look if your interested: Building the APK — AndroidAPS 3.0 documentation

Oh yeah, you’re right, my bad.

I personally don’t think this is something F-Droid should actively support, as it’s quite an edge case and it’ll increase the amount of non-tehnical users who may get confused.

I’d say if Neo Store does what you want, just stick with that :slight_smile: One of the powers of Open Source is being able to have different clients for different needs (because no one program can ever make every single person happy) :slight_smile:

No worries, and yeah spot on with OSS:)

Thanks for everything fdroid btw! Its really great to have a repo of great OSS packages for your phone!!

There are some rare cases where apps get in a weird state and a reinstall (without wipe) actually does fix.