4

Howto downgrade any app to the previous version without losing data on android 8.1 ?

EDIT 0 : Nota Bene : Here, Fairemail is given as an example, my question is not app specific but Android specific. I'm actually asking how to downgrade any app to it's previous release having already downloaded the apk.

Here is the information of the package eu.faircode.email I want to push to downgrade :

$ du -h eu.faircode.email_1036.apk
13M eu.faircode.email_1036.apk
$ aapt2 dump badging eu.faircode.email_1036.apk | egrep '^$|package|[s]dkVersion:|application-label:|native-code:'
package: name='eu.faircode.email' versionCode='1036' versionName='1.1036' platformBuildVersionName='' platformBuildVersionCode='' compileSdkVersion='29' compileSdkVersionCodename='10'
sdkVersion:'21'
application-label:'FairEmail'
native-code: 'arm64-v8a' 'armeabi-v7a' 'x86' 'x86_64'

I tried to reinstall this app without data-loss :

$ adb install -r -d eu.faircode.email_1036.apk
Performing Streamed Install
adb: failed to install eu.faircode.email_1036.apk: Failure [INSTALL_FAILED_VERSION_DOWNGRADE]

but it didn't work, so I tried the un-installation of this app without data loss and it worked :

$ adb uninstall -k eu.faircode.email
The -k option uninstalls the application while retaining the data/cache.
At the moment, there is no way to remove the remaining data.
You will have to reinstall the application with the same signature, and fully uninstall it.
If you truly wish to continue, execute 'adb shell cmd package uninstall -k'.
$ adb shell cmd package uninstall -k eu.faircode.email
Success

But then the installation of eu.faircode.email_1036.apk didn't :

$ adb install eu.faircode.email_1036.apk
Performing Streamed Install
adb: failed to install eu.faircode.email_1036.apk: Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
$ adb install -d eu.faircode.email_1036.apk
Performing Streamed Install
adb: failed to install eu.faircode.email_1036.apk: Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
$ echo $?
1

It seems adb install -d is only use-able with debuggable packages only according to this :

$ adb | grep downgrade
      -d: allow version code downgrade (debuggable packages only)

Can you help me ?

1
  • For me, using Termux, I could downgrade connectbot using cmd package install -d my.apk -- see also github.com/connectbot/connectbot/issues/1031. Presumably this package has debugging enabled? The command simply reported Success after a few seconds and the app worked again on my device.
    – Luc
    Commented Oct 28, 2021 at 21:13

3 Answers 3

3

What you want is not possible and for a good reason: updated data structures (files, database, etc) are often incompatible with old app versions. This is why you can downgrade debuggable packages (for development purposes) only.

If you have a problem with FairEmail, please report it in this forum:

https://forum.xda-developers.com/android/apps-games/source-email-t3824168

4
  • 1
    @M66B Last I downgraded another app because it was crashing on my device. This question is not app specific. I'm actually asking how to downgrade any app to it's previous version having already downloaded the apk.
    – SebMa
    Commented Mar 24, 2020 at 16:44
  • @SebMa the answer was intended to be generic, but I was not sure if the question was general, hence the link to the FairEmail forum
    – M66B
    Commented Mar 24, 2020 at 17:39
  • I understand the risk. Although I'm not sure developers bother update their data structures every now and then, otherwise they will have to rewrite their I/O components often.
    – SebMa
    Commented Mar 25, 2020 at 1:01
  • @SebMa especially when using Android ROOM it is easy to add new fields for new features to an existing database, so this might happen more than you think.
    – M66B
    Commented Mar 25, 2020 at 7:39
2

If your device is rooted, there's a work-around (apply at your own risk – as Marcel correctly pointed out, there's a reason why it's made close to impossible):

  1. install
  2. backup the app you want to downgrade
  3. uninstall the app you want to downgrade (completely, i.e. app & data)
  4. install the older version
  5. use Titanium Backup to restore data only

This worked for me in several cases. No guarantees however: if the newer version changed structures in its databases/configuration, you will end up with an unstable app – and later updates might fail (in those cases, use TiBu to restore the full backup you made originally – so make sure to keep that one safe).

3
  • The pb. is that my device is not rooted. I've read about this, have you tried it ?
    – SebMa
    Commented Mar 25, 2020 at 0:59
  • 1
    Also *migration mode * in settings may be needed to ensure DB integrity
    – beeshyams
    Commented Mar 25, 2020 at 7:31
  • 1
    @SebMa Yes, I have – and am quite happy with it. TiBu works fine on Magisk (to my experience on multiple devices, you can safely ignore TiBu's warning concerning SuperUser in that configuration).
    – Izzy
    Commented Mar 25, 2020 at 7:41
0

Nokia TA-1041, android 8.0.0.

Android Debug Bridge version 1.0.39 Version 1:8.1.0+r23-5ubuntu2

Ubuntu 20.04.3 LTS x86_64 Kernel: 5.13.0-40-generic

I actually met a similar problem, when downgrading the WeChat from 8.0.18 to 7.0.21. I tried adb install -r -d and adb install -r -t -d, both of them does not work, with the error [INSTALL_FAILED_VERSION_DOWNGRADE].
However, I tried this method, it works. https://moreless.medium.com/how-to-downgrade-an-android-app-without-losing-chat-history-afea00141601

  1. adb shell cmd package uninstall -k <package> to uninstall package.
  2. adb reboot to reboot your phone.
  3. adb install <package_apk_file.apk> to install a lower version app.

Note that the reboot is very important, this step could not be avoided. I actually tried adb shell cmd package uninstall -k before reading the page above. But as long as I do not reboot, the lower version could not be installed, with the error [INSTALL_FAILED_VERSION_DOWNGRADE].

Additionally, https://blog.csdn.net/u012852597/article/details/108814434 from this article, it seems that you could also try to copy the apk file to '/data/local/tmp/' and install the apk.

2
  • Your answer basically just links to medium.com where the actual solution is described which is bad style for answers as linked web pages can change at any time or the link goes dead which makes your answer useless. Please always include the relevant steps for solving the problem.
    – Robert
    Commented Apr 21, 2022 at 12:01
  • Modified. Is it good now?
    – la la
    Commented Apr 21, 2022 at 21:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .