[ASUS ZenFone 8] bnsmb:
IMHO Titanium Backup is still one of the best apps to backup and restore apps and data in the Android OS.

Update 08.07.2024

Unfortunately, this is no longer the case - since Android uses different users and permissions for each app, restoring an app via Titanium Backup is only possible with manual intervention.

Nevertheless, the information below is still valid

But sometimes the Titanium Backup just hangs while restoring files.

In this case the first checks should be (as already mentioned in various other posts, for example here: https://xdaforums.com/t/tibu-stuck-at-0-restoring-apps-anyone-else.3569959/#post-71347448 ):

If this does not fix the problem and you're running Android 14 or newer, the error could be caused by you trying to restore a somehow "outdated" app. Titanium Backup creates apk files in it's data directory to be able to restore the apps later. So to check this, open an adb shell and try to install the apk file from the backup manual using the command "pm install", e.g.:

ASUS_I006D:/ $ cd /sdcard/TitaniumBackup
ASUS_I006D:/sdcard/TitaniumBackup $

ASUS_I006D:/sdcard/TitaniumBackup $ cat net.momodalo.app.vimtouch-5d7d195f2c9f5a0d04facb2dd060f73f.apk | pm install -S 3611858
Failure [INSTALL_FAILED_DEPRECATED_SDK_VERSION: App package must target at least SDK version 23, but found 17]
1|ASUS_I006D:/sdcard/TitaniumBackup $

Android 14 does not allow the installation of apps with outdated target SDK version anymore:

see https://developer.android.com/about/versions/14/behavior-changes-all

AFAIK the only method to install packages with an outdated target SDK version is manuall in an adb shell with the additional parameter --bypass-low-target-sdk-block for the command "pm install", example:

ASUS_I006D:/sdcard/TitaniumBackup $ cat net.momodalo.app.vimtouch-5d7d195f2c9f5a0d04facb2dd060f73f.apk | pm install --bypass-low-target-sdk-block -S 3611858
Success
ASUS_I006D:/sdcard/TitaniumBackup $

Unfortunately Titanium Backup does not support this approach and therefor just hangs trying to install an outdated App (and I don't think there will be a new, fixed version from Titanum Backup in the future ...)

Therefore, to continue the restore via Titanium Backup, either delete all apk files with outdated target sdk version from the directory /sdcard/TitaniumBackup on the phone and then execute Titanium Backup again or manually reinstall these apps before running Titanium Backup. Deleting the apk files is not really a sensible method here; the better solution is to install all the apps involved manually before starting Titanium Backup.

Since it is a bit difficult to find out whether an apk file is affected by this problem or not and there may be a lot of apks with this issue, I have created a small script for it:

check_apks.sh

The usage for check_apks.sh is

[ OmniRom 14 Dev - xtrnaw7@t15g ~ ] $ check_apks.sh -h
check_apks.sh - check the target sdk version of apk files

Usage:

cd <dir_with_apk_files>
check_apks.sh [sdk=nn] [for_android] > <output_file_for_the_pm_commands_to_install_the_apks>

The parameter "sdk=nnn" can be used to change the SDK version used to check the target sdk version in the apk files
If the parameter "for_android" is used, the script creates commands that must be executed in a shell on the phone
even if running on a PC.

Use the environment variable AAPT to define the aapt executable to be used (if not available via PATH variable)
Use the environment variable TMPFILE_DIR to define a different directory for temporary files

The default sdk version for the check is 23
The default directory for temporary files is /tmp
The aapt executable to use is "/data/develop/android/android_sdk/build-tools/34.0.0/aapt"

[ OmniRom 14 Dev - xtrnaw7@t15g ~ ] $

The script can be executed on a PC running Linux or on the phone running the Android OS. The only requirement is the executable aapt from the Android SDK.

The Android SDK can be downloaded from here https://developer.android.com/tools; the executable aapt is also part of the repositories to build a custom ROM for Android (at least in the repositories for the OmniROM; for Linux the executable is ./prebuilts/sdk/tools/linux/bin/aapt).

check_apks.sh checks the configured target SDK version in the apk file for each apk file in the current directory and, if this is too low, writes the necessary pm install command for manual installation of the apk file to STDOUT.

for example (running check_apks.sh on a PC with a copy of the directory /sdcard/TitaniumBckup from the phone):

[ OmniRom 14 Dev - xtrnaw7@t15g /data/backup/ASUS_ZENFONE8/data_backup/ASUS_I006D/TitaniumBackup ] $ check_apks.sh
check_apks.sh - check the target sdk version of apk files

NOT running in the Android OS
Creating "pm install" commands that must be executed on the PC

Searching for apk files with a target sdk value less then 23
The pm commands to install the apks will be written to "standard output (use redirection for stdout (> <filename>) to write to a file)"

Processing the apk files in the directory "/data/backup/ASUS_ZENFONE8/data_backup/ASUS_I006D/TitaniumBackup" ...
3 apk(s) found
Creating the list of latest apk files ..:
..."n3 unique apk(s) found

Processing the file "net.momodalo.app.vimtouch-5d7d195f2c9f5a0d04facb2dd060f73f.apk" ...
This is the app "Vi IMproved Touch 2.3"; the target sdk version is 17
The target sdk version is too old - writing the pm install command to STDOUT ...

# Vi IMproved Touch 2.3 - target sdk version: 17
cat net.momodalo.app.vimtouch-5d7d195f2c9f5a0d04facb2dd060f73f.apk | adb shell pm install --bypass-low-target-sdk-block -S 3611858
Processing the file "org.jessies.dalvikexplorer-960d5c3572ca30db1e7af1e94ad64819.apk" ...
This is the app "Dalvik Explorer 3.9"; the target sdk version is 19
The target sdk version is too old - writing the pm install command to STDOUT ...

# Dalvik Explorer 3.9 - target sdk version: 19
cat org.jessies.dalvikexplorer-960d5c3572ca30db1e7af1e94ad64819.apk | adb shell pm install --bypass-low-target-sdk-block -S 102780
Processing the file "ws.xsoh.etar-e5fac22dc5e52662d452440be682af76.apk.gz" ...
This is the app "Etar 1.0.42"; the target sdk version is 34
The target sdk version okay

3 apk file(s) processed

2 apk file(s) found with outdated target sdk

The pm commands to install the apks are stored in the file "standard output (use redirection for stdout (> <filename>) to write to a file)"

The list of apks including the target sdk size were written to "/tmp/apks.773891.lst"

[ OmniRom 14 Dev - xtrnaw7@t15g /data/backup/ASUS_ZENFONE8/data_backup/ASUS_I006D/TitaniumBackup ] $

The commands for the manual installation of the apk files in the above output are lines contained in "pm install".

check_apks.sh writes all messages to STDERR and can therefore be used with a redirection for STDOUT to create a file that only contains the commands for manual installation of the apks:

[ OmniRom 14 Dev - xtrnaw7@t15g /data/backup/ASUS_ZENFONE8/data_backup/ASUS_I006D/TitaniumBackup ] $ check_apks.sh >/tmp/install_apks.sh
check_apks.sh - check the target sdk version of apk files

NOT running in the Android OS
Creating "pm install" commands that must be executed on the PC

Searching for apk files with a target sdk value less then 23
The pm commands to install the apks will be written to "/tmp/install_apks.sh"

Processing the apk files in the directory "/data/backup/ASUS_ZENFONE8/data_backup/ASUS_I006D/TitaniumBackup" ...
3 apk(s) found
Creating the list of latest apk files ..:
..."n3 unique apk(s) found

Processing the file "net.momodalo.app.vimtouch-5d7d195f2c9f5a0d04facb2dd060f73f.apk" ...
This is the app "Vi IMproved Touch 2.3"; the target sdk version is 17
The target sdk version is too old - writing the pm install command to STDOUT ...
Processing the file "org.jessies.dalvikexplorer-960d5c3572ca30db1e7af1e94ad64819.apk" ...
This is the app "Dalvik Explorer 3.9"; the target sdk version is 19
The target sdk version is too old - writing the pm install command to STDOUT ...
Processing the file "ws.xsoh.etar-e5fac22dc5e52662d452440be682af76.apk.gz" ...
This is the app "Etar 1.0.42"; the target sdk version is 34
The target sdk version okay

3 apk file(s) processed

2 apk file(s) found with outdated target sdk

The pm commands to install the apks are stored in the file "/tmp/install_apks.sh"

The list of apks including the target sdk size were written to "/tmp/apks.774194.lst"

[ OmniRom 14 Dev - xtrnaw7@t15g /data/backup/ASUS_ZENFONE8/data_backup/ASUS_I006D/TitaniumBackup ] $

Now the commands to install the apk files are written to the file /tmp/install_apks.sh:

[ OmniRom 14 Dev - xtrnaw7@t15g /data/backup/ASUS_ZENFONE8/data_backup/ASUS_I006D/TitaniumBackup ] $ cat /tmp/install_apks.sh

# Vi IMproved Touch 2.3 - target sdk version: 17
cat net.momodalo.app.vimtouch-5d7d195f2c9f5a0d04facb2dd060f73f.apk | adb shell pm install --bypass-low-target-sdk-block -S 3611858

# Dalvik Explorer 3.9 - target sdk version: 19
cat org.jessies.dalvikexplorer-960d5c3572ca30db1e7af1e94ad64819.apk | adb shell pm install --bypass-low-target-sdk-block -S 102780
[ OmniRom 14 Dev - xtrnaw7@t15g /data/backup/ASUS_ZENFONE8/data_backup/ASUS_I006D/TitaniumBackup ] $

The script prints an entry for each apk with outdated configuration - in most cases it is not useful to restore all apks (e.g. there might be some apks in the backup that are already deleted from the phone) so I recommend checking the pm install commands in the file created by check_apks.sh and deleting or commenting out all unnecessary entries.

Since the name of an app can usually not be determined from the name of the apk file, check_apks.sh always prints the name and, if it can be determined from the apk file, the version of the app.

After all apks with outdated sdk target versions have been installed via the "pm install" command, you can restore the remaining apps from the backup using the menu points for restoring missing apps in Titanium backup.

Note that the commands for manual installation of the apk file are preceded by "adb shell " when the script is executed on a PC so that the apks can be installed via adb on the PC (use the script parameter "for_android" to disable that feature).

The default Android SDK version used for the check is hardcoded in the script:

# required target sdk version for the running Android OS
#
REQUIRED_MINIMUM_TARGET_SDK_VERSION=23

To check for another target SDK version use the script parameter skd=nnn, e.g. to create the "pm install" command for all apk files in a directory, execute the script with the parameter "sdk=100"

Notes:

check_apk.sh never installs or changes anything on the phone.

How to get an aapt executable for the Android OS

A git repository with scripts and config files to create the SDK tools for the aarch64 CPU is here :

https://github.com/lzhiyong/android-sdk-tools

I have tested the instructions on this page, but unfortunately the exact version of the SDK and NDK used to create the instructions is missing, and with the current versions of the kits the configuration files used do not work out of the box.

A compiled SDK for running in the Android OS on a phone with aarch64 CPU is available here:

https://github.com/Lzhiyong/termux-ndk/releases/download/android-sdk/android-sdk-aarch64.zip

To extract only the aapt executable for the Android OS from the zip file do:

[ OmniRom 14 Dev - xtrnaw7@t15g /data/img/android ] $ unzip -p android-sdk-aarch64.zip android-sdk/build-tools/34.0.0/aapt >./aapt
[ OmniRom 14 Dev - xtrnaw7@t15g /data/img/android ] $

[ OmniRom 14 Dev - xtrnaw7@t15g /data/img/android ] $ adb push aapt /data/local/tmp/
aapt: 1 file pushed, 0 skipped. 371.2 MB/s (3897896 bytes in 0.010s)
[ OmniRom 14 Dev - xtrnaw7@t15g /data/img/android ] $

Test the executable in an shell on the phone:

ASUS_I006D:/ $ file /data/local/tmp/aapt
/data/local/tmp/aapt: ELF executable, 64-bit LSB arm64, static, for Android 30, built by NDK r24 (8215888), stripped
ASUS_I006D:/ $

ASUS_I006D:/ $ chmod 755 /data/local/tmp/aapt
ASUS_I006D:/ $

ASUS_I006D:/ $ /data/local/tmp/aapt v
Android Asset Packaging Tool, v0.2-289
ASUS_I006D:/ $

see also https://hax4us.github.io/2021-11-22-install-android-sdk-in-termux/

To download the script use this link: check_apks.sh.sh

Notes

see also How to install packages (apk files) for Android via script

The script check_apks.sh is a quick and dirty work and not optimized for performance. Therefor I recommend to execute it on a PC if applicable.