[2022-07-03] [v0.5.1] Universal Android Debloater

Search This thread

FourSilver

Member
Jan 11, 2021
28
4
Hi,

Thanks for your help! :)



I've added more detailed instructions. You have to run this script in the parent directory of the UAD repository/folder because by default it seeks for the lists in ./universal-android-debloater/lists
My pleasure!

I repeated the procedure with the script in parent directory; in this case, the home directory (~/)

When I run the script from the prompt as 'sh bash' in the parent directory (where 'bash' is the name of the file, as downloaded from the repository), the following is returned from the command line:

bash: 5: cannot open : no such file

(BTW: The response is the same when the script is run using './bash')

When I run the script as 'bash bash' (where the latter/second 'bash' is the name of the downloaded file), the following response is issued:

bash: line 10: No such file or directory

What is the proper syntax for running the script?
 
Last edited:

w1nst0n_fr

Member
Dec 27, 2019
46
216
github.com
Oh! Okay... I don't know why the file is called like that. It shouldn't be called bash at all. That's the first issue. Bash is a linux internal command. I renamed it (remove_duplicates.sh).

I also modified a little bit the script so make sure to use the last version.

1) Download the repository (or clone it with git if you plan to do a pull request) and extract the zip somewhere (let say /home/username/Documents)

2) Download the snippet and save it to /home/username/Documents

3) Put your package list in the same directory

4) Open a unix terminal and from /home/username/Documents type :
Bash:
 sh remove_duplicates.sh yourlist.sh

There should be no problem anymore. :)
 

FourSilver

Member
Jan 11, 2021
28
4
4) Open a unix terminal and from /home/username/Documents type :
Bash:
 sh remove_duplicates.sh yourlist.sh

There should be no problem anymore. :)
Ah! I somehow missed that it required an argument. The output is the same as I reported earlier (i.e. no such file); I imagine it is because I have not listed the yourlist.sh file.

Seeing that I have a device that is not currently present in the list of devices recognized by the Debloater tool (i.e. Atom XL), how do I create the content that goes into the yourlist.sh file?
 
Last edited:
Apr 3, 2019
18
14
Hopefully some simple questions. I notice that this tool is using pm uninstall to remove the apps, and then rm -rf to remove the apk and folder if using root. I think if using root that both actions are performed. Other tools (like https://xdaforums.com/t/a3-2017-ore...ebloated-extra-features.3793694/post-83490679) just remove the folder.

Is there a benefit to using either technique?

I would guess the just deleting the folder could potentially leave some orphaned directories and databases, but maybe everything in Android is all stored in one location?

If I use a script which performs rm -rf from within TWRP before first start of the device (after new flash of ROM), would this remove the apps before they are installed, or have the device manufacturer/ROM builder already installed these apps within the firmware?

I am planning to go back to stock ROM on my device (Samsung A320FL), and looking for a good debloat tool, this seems to be the best I have found!

Thanks
 

kurtn

Senior Member
Hopefully some simple questions. I notice that this tool is using pm uninstall to remove the apps, and then rm -rf to remove the apk and folder if using root. I think if using root that both actions are performed. Other tools (like https://xdaforums.com/t/a3-2017-ore...ebloated-extra-features.3793694/post-83490679) just remove the folder.

Is there a benefit to using either technique?

I would guess the just deleting the folder could potentially leave some orphaned directories and databases, but maybe everything in Android is all stored in one location?

If I use a script which performs rm -rf from within TWRP before first start of the device (after new flash of ROM), would this remove the apps before they are installed, or have the device manufacturer/ROM builder already installed these apps within the firmware?

I am planning to go back to stock ROM on my device (Samsung A320FL), and looking for a good debloat tool, this seems to be the best I have found!

Thanks
I have the a3 2017 and I'm happy with none root debloating.
 

w1nst0n_fr

Member
Dec 27, 2019
46
216
github.com
I imagine it is because I have not listed the yourlist.sh file.

Seeing that I have a device that is not currently present in the list of devices recognized by the Debloater tool (i.e. Atom XL), how do I create the content that goes into the yourlist.sh file?

Yes, you need to pass a file (containing a list of packages) as argument of the script.

You can pass the list of all the packages of your device.

To generate the list:
Bash:
adb shell 'pm list packages -s' | sed 's/package://g' | sort > myPackageList.txt

Note: Don't forget to add quotes to the packages name in your list. The script which check for duplicates will not work if your list isn't formatted like this :

Code:
"com.samsung.android.provider.filterprovider"
"com.android.cts.priv.ctsshim"
"com.gd.mobicore.pa"
"com.samsung.android.app.aodservice"
"com.android.providers.telephony"
"com.samsung.android.applock"
"com.sec.automation"
"com.android.providers.media"

Then, run the script like this:
Bash:
sh remove_duplicates.sh myPackageList.txt

I've updated the wiki and the snippet description to be more noob friendly ! :)
 

w1nst0n_fr

Member
Dec 27, 2019
46
216
github.com
Hi,

I notice that this tool is using pm uninstall to remove the apps, and then rm -rf to remove the apk and folder if using root
The script doesn't work like that. pm uninstall is only performed if you choose the non-root debloat feature. Root debloat only does a rm -rf /path/to/apk in v2.8.4. In 2.9 it will be a systemless debloat for Android 10+ devices (see the release notes for v2.9-temp if you don't understand why)

If I use a script which performs rm -rf from within TWRP before first start of the device (after new flash of ROM), would this remove the apps before they are installed, or have the device manufacturer/ROM builder already installed these apps within the firmware?

(This kind of script will not work on Android 10+ devices)

You can't remove apps on a phone if they haven't been installed in the first place. However, they won't never run as you removed them before the first system boot. So it's okay.

What you can also do is directly modify the ROM flashable zip and remove the apps/apks you don't want so that when you'll flash the ROM the apps won't be installed. @_alexndr unfortunately doesn't provide a ROM for your phone. He maintains custom stock ROMs for Samsung Galaxy S phones and gives a way to easily debloat the ROM. He is a really serious, talented and conscientious developer.
 
Apr 3, 2019
18
14
Hi,


The script doesn't work like that. pm uninstall is only performed if you choose the non-root debloat feature. Root debloat only does a rm -rf /path/to/apk in v2.8.4. In 2.9 it will be a systemless debloat for Android 10+ devices (see the release notes for v2.9-temp if you don't understand why)



(This kind of script will not work on Android 10+ devices)

You can't remove apps on a phone if they haven't been installed in the first place. However, they won't never run as you removed them before the first system boot. So it's okay.

What you can also do is directly modify the ROM flashable zip and remove the apps/apks you don't want so that when you'll flash the ROM the apps won't be installed. @_alexndr unfortunately doesn't provide a ROM for your phone. He maintains custom stock ROMs for Samsung Galaxy S phones and gives a way to easily debloat the ROM. He is a really serious, talented and conscientious developer.

Thanks for the reply, that is clear. The official ROM for the A320FL is only Oreo (Android 8) anyway. Pie and 10 have been ported from other devices, and also 3rd party like Lineage, but they all have different problems (H-ROM from @Astrako is definitely the best I have tried, and only a few minor niggles). Right now I was planning to try latest Oreo stock ROM for a period of time and maybe switch again later. I noticed the problem with mounting system as RW when I last tested a 10 ROM, but never caused me enough problems to look into why this didn't work!

Will systemless debloat be used on all devices after V2.9 or will older devices still mount system and delete the APK?

By just deleting the APK folder, do you get any orphan data left over (i.e. in shared storage folders within /data/data?). Maybe if the app is never run then these folders are not created? Would using
Code:
pm clear com.yourapp.packagename
before removing the app clear off any data folders that are remaining? Maybe SD Maid or similar app can find the orphan files afterwards and delete them. Or I guess they are probably only small (especially if you have never used the app) so maybe it is not worth the effort and they are doing no harm?
 

FourSilver

Member
Jan 11, 2021
28
4
I've updated the wiki and the snippet description to be more noob friendly ! :)
Support for n00bs is _always_ appreciated! :p

The snippet works! However, after I create an aosp debloat list using the debloat script, I am given the option to physically delete the apks. By electing yes, I get the following error:
Code:
[EXIT TRAP] Hum... something is wrong. Error on line 414

If you think this is a bug. Please report it :)
==> https://gitlab.com/W1nst0n/universal-android-debloater/-/issues
I believe it is because I missed the countdown the first time I was prompted to accept the action on the device. How can I get the prompt again so I can accept the deletions? (I know this is possibly more a Magisk question, but I figured I'd ask...)
 

w1nst0n_fr

Member
Dec 27, 2019
46
216
github.com
-------------- New Version (v2.9) --------------

Systemless debloat support. Root features should finally work for all Android versions. Check the full changelog on Gitlab.

Note: The debloat_script.sh is now in maintenance mode and won't receive any more features. The focus is on the developement of a GUI.

-------------------------------------------------------

Will systemless debloat be used on all devices after V2.9 or will older devices still mount system and delete the APK?

You can choose between the 2 methods.

By just deleting the APK folder, do you get any orphan data left over (i.e. in shared storage folders within /data/data)?. Maybe if the app is never run then these folders are not created? Would using pm clear com.yourapp.packagename before removing the app clear off any data folders that are remaining?

Yes, you'll get a bunch of orphan files (apps data, cache, oat files) if the apps already run on your phone.

Performing pm clear only remove app data and cache. It doesn't remove the folders nor oat files (precompiled code of the app) but that's well enough.

v2.9 does this before any root debloat.

Maybe SD Maid or similar app can find the orphan files afterwards and delete them. Or I guess they are probably only small (especially if you have never used the app) so maybe it is not worth the effort and they are doing no harm?

Yes. That's it. It is not worth the effort all the more so SD Maid exists. This is a really good app, made by a nice person on top of that.

I believe it is because I missed the countdown the first time I was prompted to accept the action on the device. How can I get the prompt again so I can accept the deletions? (I know this is possibly more a Magisk question, but I figured I'd ask...)

The error being line 414, you indeed missed the countdown.

In Magisk Manager (last version), click on the shield icon in the dock (at the bottom of the app). Then, allow superuser rights to Shell
 
Last edited:

forjest63

Senior Member
Dec 10, 2018
57
15
Samsung Galaxy A52 4G
hi i am getting the following error. how can i solve this?
sshot-1.png
 

FourSilver

Member
Jan 11, 2021
28
4
-------------- New Version (v2.9) --------------

Systemless debloat support. Root features should finally work for all Android versions. Check the full changelog on Gitlab.

Note: The debloat_script.sh is now in maintenance mode and won't receive any more features. The focus is on the developement of a GUI.

-------------------------------------------------------
The error being line 414, you indeed missed the countdown.

In Magisk Manager (last version), click on the shield icon in the dock (at the bottom of the app). Then, allow superuser rights to Shell
It turns out that I had the rights allowed for Shell in Magisk Manager. Not sure why I could not get another chance...

To address the operator error, I wiped the device and started over. I downloaded version 2.9 and issued bash debloat_script.sh, and I was not prompted for root access. The menu now seems to include options for unihertz and mediatek, although nothing turned up for the former. (Perhaps I missed these earlier?) I was able to create zip files for apks to debloat using the mediatek option, along with the aosp option. I then used Magisk Manager to install these files.

As a check, I installed the de-bloater package from F-Droid, and checked for the presence of com.adups.fota (which is considered malware, according to MITRE.) It is currently no longer on the device.

Thanks for the support!
 

0wdj

Member
Oct 25, 2020
18
2
How to completely remove the APK with root?
I got this error when I try to delete chrome

Code:
Clearing app data...

com.android.chrome -->
Exception occurred while executing 'clear':
java.lang.SecurityException: PID 29500 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.android.chrome
        at com.android.server.am.ActivityManagerService.clearApplicationUserData(ActivityManagerService.java:4428)
        at com.android.server.pm.PackageManagerShellCommand.runClear(PackageManagerShellCommand.java:2100)
        at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:227)
        at android.os.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:98)
        at android.os.ShellCommand.exec(ShellCommand.java:44)
        at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:22135)
        at android.os.Binder.shellCommand(Binder.java:929)
        at android.os.Binder.onTransact(Binder.java:813)
        at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4687)
        at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4408)
        at android.os.Binder.execTransactInternal(Binder.java:1159)
        at android.os.Binder.execTransact(Binder.java:1123)


[EXIT TRAP] Hum... something is wrong. Error on line 226
 
Apr 3, 2019
18
14
-------------- New Version (v2.9) --------------

Systemless debloat support. Root features should finally work for all Android versions. Check the full changelog on Gitlab.

Note: The debloat_script.sh is now in maintenance mode and won't receive any more features. The focus is on the developement of a GUI.

-------------------------------------------------------



You can choose between the 2 methods.



Yes, you'll get a bunch of orphan files (apps data, cache, oat files) if the apps already run on your phone.

Performing pm clear only remove app data and cache. It doesn't remove the folders nor oat files (precompiled code of the app) but that's well enough.

v2.9 does this before any root debloat.



Yes. That's it. It is not worth the effort all the more so SD Maid exists. This is a really good app, made by a nice person on top of that.



The error being line 414, you indeed missed the countdown.

In Magisk Manager (last version), click on the shield icon in the dock (at the bottom of the app). Then, allow superuser rights to Shell
Thanks for the reply, this is clear and very helpful. Your hard work on this tool is very much appreciated!
 
  • Like
Reactions: w1nst0n_fr

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    I want to remove some pre-installed apps such as Browser and Appstore completely and permanently on the stock ROM, I mean they can't come back even after doing a factory reset. Do you know if there is any way to do that?
    That's a completely different use case. For your task you have to unlock the bootloader, root and/or install a custom recovery. Modify the system partition content. And never ever relock the bootloader.
  • 150
    Universal Android Debloater

    v0.5.0.png

    This is a complete rewrite in Rust of the UAD bash script.

    DISCLAIMER : Use this software at your own risk. I am not responsible for anything that could happen to your phone.


    Summary
    I try to maintain a universal tool which removes bloatwares on any Android phones by using ADB.

    The main goal is to improve battery performance and privacy by removing unnecessary and obscure system apps. This can also contribute to improve security by reducing the attack surface.

    Packages are as well documented as possible in order to provide a better understanding of what you can delete or not. The worst thing which could happen is removing an essential system package needed during boot causing then an unfortunate bootloop. After about 5 failed system boots, the phone will automatically reboot in recovery mode and you'll have to perform a FACTORY RESET. So make a backup first!

    In any case, you can NOT brick your device with this script ! That's the main thing, right ? :)

    Features
    • Uninstall/Disable and Restore/Enable system packages
    • Multi-user support (e.g apps in work profiles)
    • Export/Import your selection in uad_exported_selection.txt
    • Multi-device support: you can connect multiple phones at the same time
    • All your actions are logged so you never forget what you've done

    NB : System apps cannot really be uninstalled without root (see the FAQ)

    Universal debloat lists
    • GFAM (Google/Facebook/Amazon/Microsoft)
    • AOSP
    • Manufacturers (OEM)
    • Mobile carriers
    • Qualcomm / Mediatek / Miscellaneous

    Manufacturers debloat lists
    • Asus
    • LG
    • Google
    • Fairphone
    • Huawei
    • Motorola
    • Nokia
    • OnePlus
    • Oppo
    • Samsung
    • Sony
    • Xiaomi

    Mobile carriers debloat lists
    • French carriers: SFR / Orange / Free / Bouygues
    • US carriers: T-mobile / Verizon / AT&T / Sprint
    • German carriers: Telekom
    • UK: EE

    How to use

    Acknowledgement
    14
    How to contribute

    See here

    How to report bugs

    Open an issue on Github. I rarely respond on this XDA thread.
    7
    Looks like a new developer stepped in:
    Yes, hello!
    That'd be me :)
    If you all have any issues, feel free to create an issue over on github!

    Looking forward to improving UAD together!
    5
    I try extreme google debloat on Samsung A3 2017. First check was OK. Debloater 2.1 with standard settings GFAM worked fine. Factory reset completely restored all the bloatware.

    Second try:
    Install f-droid and hacker's keyboard before install
    $ adb push F-Droid.apk /storage/emulated/0
    $ adb push org.pocketworkstation.pckeyboard_1041001.apk /storage/emulated/0
    Replace all #"com.google with "com.google in /lists/Google.sh
    Debloat GFAM
    Reboot is OK. Playstore still there, but can be deactivated. Samsung_bloat can't be debloated.
    Sometimes I get the message Google play services has stopped.
    F-Droid can install apps. They run.
    Galaxy store can't get deactivated.

    Edit: debloating webview was no good idea. I've got many crashes of antennapod app. Restoring helped.