Skip to content

INSTALL_FAILED_VERSION_DOWNGRADE using option --allow-reboot Samsung S22 #134

@NicolasRestrepoTorres

Description

@NicolasRestrepoTorres

Describe the bug
I have a Samsung S22 SM-S901E can't get past the the legacy Whatsapp version installation, even if I have the .apk it always gives me the [INSTALL_FAILED_VERSION_DOWNGRADE: Downgrade detected on app uninstalled with DELETE_KEEP_DATA: Update version code 450146 is older than current 252381010]

To Reproduce
Steps to reproduce the behavior:

  1. run sudo python3 wa_kdbe.py -ar -s -to
  2. Enter y
  3. See error:
    adb: failed to install helpers/LegacyWhatsApp.apk: Failure [INSTALL_FAILED_VERSION_DOWNGRADE: Downgrade detected on app uninstalled with DELETE_KEEP_DATA: Update version code 450146 is older than current 252381010]

Expected behavior
I want to get the encryption key of my own WhatsApp to be able to decrypt a file like this: msgstore-yyyy-mm-dd.1.db.crypt14

Screenshots
If applicable, add screenshots to help explain your problem.

Terminal output or log file

====== Logging starts here. ====== 
File: wa_kdbe.py
Date: Saturday 06/09/2025, 13:35:34
If you see any password here then do let know @github.com/YuvrajRaghuvanshiS/WhatsApp-Key-Database-Extractor



[Saturday 06/09/2025, 13:35:34] >>> I am in device_serial_id.init(mode=USB, tcp_ip, tcp_port=)
[Saturday 06/09/2025, 13:35:34] >>> I am in wa_kdbe.main()
[Saturday 06/09/2025, 13:35:34] >>> I am in wa_kdbe.check_bin()
[Saturday 06/09/2025, 13:35:34] >>> I am in wa_kdbe.show_banner()

================================================================================
========                Current release date: 21/04/2022                ========
========                                                                ========
========  db   d8b   db  .d8b.         db   dD d8888b. d8888b. d88888b  ========
========  88   I8I   88 d8' `8b        88 ,8P' 88  `8D 88  `8D 88'      ========
========  88   I8I   88 88ooo88        88,8P   88   88 88oooY' 88ooooo  ========
========  Y8   I8I   88 88~~~88 C8888D 88`8b   88   88 88~~~b. 88~~~~~  ========
========  `8b d8'8b d8' 88   88        88 `88. 88  .8D 88   8D 88.      ========
========   `8b8' `8d8'  YP   YP        YP   YD Y8888D' Y8888P' Y88888P  ========
========                                                                ========
================================================================================

============ WhatsApp Key / Database Extrator for non-rooted Android ===========

================================================================================
===                                                                          ===
===  xxxxx  PLEASE TAKE WHATSAPP CHAT BACKUP BEFORE GETTING STARTED.  xxxxx  ===
===                                                                          ===
===     For that go to "WhatsApp settings → Chat Settings → Chat Backup"     ===
===              here take a local backup. Prepare for Worst.                ===
===                                                                          ===
===  Also if you see a folder "Android/media/com.whatsapp" copy it somewhere ===
===   safe. New versions of WhatsApp are saving data here INCLUDING IMAGES   ===
===       AND VIDEOS. I try to save it while uninstalling WhatsApp but       ===
===                        YOU CAN NEVER BE TOO SAFE.                        ===
===                                                                          ===
===     This script can extract your WhatsApp msgstore.db (non crypt12,      ===
===   un-encrypted file) and your "key" file from "/data/data/com.whatsapp"  ===
===  directory in Android 4.0+ device without root access. However you need  ===
===   to have JAVA installed on your system in order to "view the extract".  ===
===  If you don't have JAVA installed then you can "view extract" later by   ===
===   running "view_extract.py". The idea is to install a "Legacy WhatsApp"  ===
===       temporarily on your device in order to get the android backup      ===
===    permission. You should not lose any data and your current WhatsApp    ===
===   version will be installed after this process so don't panic and don't  ===
=== stop this script while it's working. However if something fails you can  ===
===    run "restore_whatsapp.py" and reinstall current WhatsApp or simply    ===
===                    update that from Google Play Store.                   ===
===                                                                          ===
===                      Script by: Yuvraj Raghuvanshi                       ===
===                      Github.com/YuvrajRaghuvanshiS                       ===
================================================================================
    
[Saturday 06/09/2025, 13:35:34] >>> I am in wa_kdbe.check_java()
[Saturday 06/09/2025, 13:35:34] Found Java v11.0.28 installed on system. Continuing...

[Saturday 06/09/2025, 13:35:34] Arguments passed: Namespace(allow_reboot=True, tcp_ip=None, tcp_port='5555', scrcpy=True, tar_only=True)
[Saturday 06/09/2025, 13:35:34] >>> I am in wa_kdbe.get_sys_info()
[Saturday 06/09/2025, 13:35:34] System Info: {
  "Architecture": "x86_64",
  "Hostname": "nicolas-GE60-2QD",
  "Platform": "Linux",
  "Platform Release": "6.8.0-65-generic",
  "Platform Version": "#68~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 15 18:06:34 UTC 2",
  "Processor": "x86_64",
  "RAM": "16 GB",
  "Python": [
    "main",
    "Aug 15 2025 14:32:43"
  ]
}
[Saturday 06/09/2025, 13:35:34] Turned off wifi and mobile data...
[Saturday 06/09/2025, 13:35:34] >>> I am in wa_kdbe.run_scrcpy(_is_scrcpy=True)
[Saturday 06/09/2025, 13:35:34] �Please read above instructions carefully ↑ . Continue? (default y): 


[Saturday 06/09/2025, 13:35:34] �If you haven't already, it is advised to take a WhatsApp chat backup by going to "WhatsApp settings → Chat Settings → Chat Backup". Hit "Enter" key to continue.
[Saturday 06/09/2025, 13:35:34] >>> I am in wa_kdbe.usb_mode()
[Saturday 06/09/2025, 13:35:34] >>> I am in handler.handler(adb=adb -s R5CT503FMYR)
[Saturday 06/09/2025, 13:35:34] Connected to SM-S901E
[Saturday 06/09/2025, 13:35:34] >>> I am in handler.after_connect(adb=adb -s R5CT503FMYR)
Starting new HTTPS connection (1): web.archive.org:443
https://web.archive.org:443 "HEAD /web/20141111030303if_/http://www.whatsapp.com/android/current/WhatsApp.apk HTTP/1.1" 200 0
[Saturday 06/09/2025, 13:35:34] WhatsApp v2.25.23.81 installed on device
[Saturday 06/09/2025, 13:35:34] Found legacy WhatsApp V2.11.431 apk in "helpers" folder
[Saturday 06/09/2025, 13:35:34] >>> I am in wa_kdbe.real_deal(sdk_version=35, whatsapp_apk_path_in_device=/data/app/~~UIByMbB8N1uXuRmp6sWSTw==/com.whatsapp-GjfDc42yCQtIJSacrGvixw==/base.apk, version_name=2.25.23.81)
[Saturday 06/09/2025, 13:35:34] >>> I am in wa_kdbe.backup_whatsapp_apk(sdk_version=35, version_name=2.25.23.81, whatsapp_apk_path_in_device=/data/app/~~UIByMbB8N1uXuRmp6sWSTw==/com.whatsapp-GjfDc42yCQtIJSacrGvixw==/base.apk)
[Saturday 06/09/2025, 13:35:34] Backing up WhatsApp 2.25.23.81 apk, the one installed on device to "/data/local/tmp/WhatsAppbackup.apk" in your phone.
[Saturday 06/09/2025, 13:35:34] Apk backup is completed.
[Saturday 06/09/2025, 13:35:34] >>> I am in wa_kdbe.uninstall_whatsapp(sdk_version=35)
[Saturday 06/09/2025, 13:35:34] Uninstalling WhatsApp, skipping data.
[Saturday 06/09/2025, 13:35:34] Uninstalled.


[Saturday 06/09/2025, 13:35:34] Rebooting device, please wait.
[Saturday 06/09/2025, 13:35:34] Waiting for device to get online | o    |
[Saturday 06/09/2025, 13:35:34] Hit "Enter" key after unlocking device.
[Saturday 06/09/2025, 13:35:34] >>> I am in wa_kdbe.install_legacy(sdk_version=35)
[Saturday 06/09/2025, 13:35:34] Installing legacy WhatsApp V2.11.431, hold tight now.
[Saturday 06/09/2025, 13:35:34] Could not install legacy WhatsApp
[Saturday 06/09/2025, 13:35:34] adb: failed to install helpers/LegacyWhatsApp.apk: Failure [INSTALL_FAILED_VERSION_DOWNGRADE: Downgrade detected on app uninstalled with DELETE_KEEP_DATA: Update version code 450146 is older than current 252381010]
Performing Streamed Install
[Saturday 06/09/2025, 13:35:34] Trying to restore WhatsApp in 00:10.
[Saturday 06/09/2025, 13:35:34] Trying to restore WhatsApp in 00:09.
[Saturday 06/09/2025, 13:35:34] Trying to restore WhatsApp in 00:08.
[Saturday 06/09/2025, 13:35:34] Trying to restore WhatsApp in 00:07.
[Saturday 06/09/2025, 13:35:34] Trying to restore WhatsApp in 00:06.
[Saturday 06/09/2025, 13:35:34] Trying to restore WhatsApp in 00:05.
[Saturday 06/09/2025, 13:35:34] Trying to restore WhatsApp in 00:04.
[Saturday 06/09/2025, 13:35:34] Trying to restore WhatsApp in 00:03.
[Saturday 06/09/2025, 13:35:34] Trying to restore WhatsApp in 00:02.
[Saturday 06/09/2025, 13:35:34] Trying to restore WhatsApp in 00:01.

[Saturday 06/09/2025, 13:35:34] >>> I am in wa_kdbe.reinstall_whatsapp()
[Saturday 06/09/2025, 13:35:34] Reinstalling original WhatsApp.
[Saturday 06/09/2025, 13:35:34] Reinstallation complete.
[Saturday 06/09/2025, 13:35:34] >>> I am in wa_kdbe.kill_me()


[Saturday 06/09/2025, 13:35:34] Exiting...
[Saturday 06/09/2025, 13:35:34] Turn off USB debugging [and USB debugging (Security Settings)] if you're done.
[Saturday 06/09/2025, 13:35:34] Hit "Enter" key to continue....

Additional context
I activated usb debugging, turn off Auto Block in samsung and added the --bypass-low-target-sdk-block flag in this way in two lines as you can see:

def install_legacy(sdk_version):
custom_print(
f">>> I am in wa_kdbe.install_legacy(sdk_version={sdk_version})", is_print=False
)
custom_print("Installing legacy WhatsApp V2.11.431, hold tight now.")
if sdk_version >= 17:
install_legacy_out = subprocess.getoutput(
f"{adb} install --bypass-low-target-sdk-block -r -d -g {helpers}LegacyWhatsApp.apk"
)
if "Success" in install_legacy_out:
custom_print("Installation Complete.")
else:
custom_print("Could not install legacy WhatsApp", "red")
custom_print(install_legacy_out, "red")
countdown("Trying to restore WhatsApp in ", 10)
reinstall_whatsapp()
kill_me()

else:
    install_legacy_out = subprocess.getoutput(
        f"{adb} install --bypass-low-target-sdk-block -r -g {helpers}LegacyWhatsApp.apk"
    )
    if "Success" in install_legacy_out:
        custom_print("Installation Complete.")
    else:
        custom_print("Could not install legacy WhatsApp", "red")
        custom_print(install_legacy_out, "red")
        kill_me()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions