[SCRIPT] [2021-01-30] [v2.9] Universal Android Debloater

Search This thread

w1nst0n_fr

Member
Dec 27, 2019
45
72
gitlab.com
Universal Android Debloater

[Logo to be created]


Bash script using ADB to debloat rooted and non-rooted smartphones. Improve your privacy and increase your battery life.

DISCLAIMER : Use this script 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. The script has a menu that lets you choose what debloat list you want to use. I strongly encourage you to take a look at the lists because the default selection may not suit you. All packages are as well documented as possible in order to provide a better understanding of what you can delete or not.

This script should be safe with the default selection. The worse thing which could happen is preventing an essential system process to be loaded during boot causing then an unfortunate bootloop. If you used the non-root solution, 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!


If you have a rooted device you can also physically delete the apks. Ironically this solution is safer because the script saves the apks before their removal. In case of bootloop you just need to run the script from a recovery with ADB support (e.g TWRP) and restore them.


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

Features
  • Quick search among all the packages of an android device
  • Uninstallation of system/user packages (manually or with the debloat lists)
  • Reinstallation of system packages (manually or with the debloat lists)
  • ADB backup/restore (not really reliable, see the FAQ)
  • Device brand detection and auto-selection of the appropriate manufacturer debloat list
  • Logging: debloated_packages.txt, remaining_packages.txt, deleted_apks.txt (for root users)
  • Root support (system and systemless with Magisk)
  • Installation of alternative open-source apps replacing stock apps (list in the WIKI section) (Not yet : WIP)

NB : The non-root method is NOT a real uninstallation for system apps (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
  • Huawei
  • Motorola
  • Nokia
  • OnePlus
  • Oppo
  • Samsung
  • Sony
  • Xiaomi

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

Download

How to use

Acknowledgement
 
Last edited:

w1nst0n_fr

Member
Dec 27, 2019
45
72
gitlab.com
How to contribute

Fetch the list of all the system packages of your phone. My script automatically exports this list in a file called remaining_packages.txt after choosing any action in the main menu.

  1. Seek for new packages not present in my debloat lists. You can use this script to check if your list has no duplicate with the current lists in the repository.
  2. Try to document each new packages and create a new issue on Gitlab.

How to decompile an APK

- Apktool
- Jadx (what I use)
- Bytecode Viewer


How to report bugs

Open an issue on Gitlab and precisely explain the issue. Screenshot(s) can help.
 
Last edited:

kurtn

Senior Member
Jan 28, 2017
3,932
1,692
Small town in Bavaria
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.
 
Last edited:

kurtn

Senior Member
Jan 28, 2017
3,932
1,692
Small town in Bavaria
Noob solution: copy Samsung list into Google list and debloat GFAM. Looks good. Only headlines are now says four times Samsung.
GMS debloat fails with some device policy error.

Next noob trick
$ adb shell
a3y17lte:/ $ pm uninstall com.google.android.gms
Failure [DELETE_FAILED_DEVICE_POLICY_MANAGER]
a3y17lte:/ $ pm disable-user com.google.android.gms
Package com.google.android.gms new state: disabled-user
 
Last edited:

Maybeyou

Member
Mar 18, 2020
47
6
Hi, thank you for this nice thread, exactly what I was looking for.
Possibly a solution for google play services:
I did deactivated the Google play services on Samsung a20 without computer by entering settings app, then "biometric and security" then "other security settings" then "device admin apps" and unselect "find my device", then head over apps in settings and "show system apps, then search for Google play services and now it can be disabled,
For samsung apps you can deactivate it by deactivating "galaxy store"
Perhaps the user must do that before running the code.
HOPE you can manage to translate that into your code language, and integrate it into your script, so we can all enjoy it.
 
Last edited:
  • Like
Reactions: kurtn

kurtn

Senior Member
Jan 28, 2017
3,932
1,692
Small town in Bavaria
Hi, I encountered a very small problem today when i tried to share a video to another phone through Wi-Fi Direct, I can't share with wifi Direct, the only available option is bluetooth (see attachment), do you how can I solve this ?
Search your "debloated packages" list for wifi related stuff and restore that. Or make sure both devices are i the same wlan and use an app like TrebleShot or KDE connect
 

w1nst0n_fr

Member
Dec 27, 2019
45
72
gitlab.com
Sorry for the wait!

I'm glad you find my project useful ! :)

Nice approach. Has someone tried to debloat Google play services? Up till now I install GApps free custom ROMs on my phones.

I don't understand your question. If you want to debloat Google Play Services why installing Gapps in the first place ? :confused:

Install f-droid and hacker's keyboard before install [...]
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. [...]
Edit: debloating webview was no good idea. I've got many crashes of antennapod app. Restoring helped.

Small tip : you can directly do
Code:
$ adb install F-droid.apk

There was a pretty nasty bug in v2.1 which prevented using the "manufacturer lists". Use v2.2.1 (or, better, wait for the v2.3 which should be released within the week!)

If you have the message `Google Play Services has stopped` it means you didn't uninstall the package. Did you uninstall some Google packages in the advanced debloat section ?

Regarding the Google Webview you can uninstall it but a lot of apps will no longer work correctly or even open. Bromite WebView is a good and more private alternative if you really need a Webview (which is a kind of mini web browser for apps which need to display web content btw)


Looks good. Only headlines are now says four times Samsung.
GMS debloat fails with some device policy error.

Hi, thank you for this nice thread, exactly what I was looking for.
Possibly a solution for google play services:
I did deactivated the Google play services on Samsung a20 without computer by entering settings app, then "biometric and security" then "other security settings" then "device admin apps" and unselect "find my device", then head over apps in settings and "show system apps, then search for Google play services and now it can be disabled,
For samsung apps you can deactivate it by deactivating "galaxy store"
Perhaps the user must do that before running the code.
HOPE you can manage to translate that into your code language, and integrate it into your script, so we can all enjoy it.

@Maybeyou is right. You need to uncheck Find My Device from the Device admin apps before trying to uninstall the Google Play Services.

I already mentioned this in the Google.sh file and a script can't do it. It's something you need to do ! I assume a user will read the package description I wrote in the advanced debloat section before doing anything.

Hi, I encountered a very small problem today when i tried to share a video to another phone through Wi-Fi Direct, I can't share with wifi Direct, the only available option is bluetooth (see attachment), do you how can I solve this ?

Mhm... I delete Wifi-direct by default but I'm gonna change this behavior for the next version.

Restore com.samsung.android.allshare.service.fileshare to get Wifi-direct back ;)
 
Last edited:
  • Like
Reactions: Maybeyou and kurtn

kurtn

Senior Member
Jan 28, 2017
3,932
1,692
Small town in Bavaria
@w1nst0n_fr thank you. My first post was not about debloating custom rom from GApps. It was a general question: is the debloater an alternative approach to get a 99% Google free phone. My answer: yes, but you need some luck. You can't know how your phone perfoms afterwards. For custom rom there are tons of reports for each device.
 
Last edited:

Maybeyou

Member
Mar 18, 2020
47
6
Sorry for the wait!

I'm glad you find my project useful ! :)

Mhm... I delete Wifi-direct by default but I'm gonna change this behavior for the next version.
Restore com.samsung.android.allshare.service.fileshare to get Wifi-direct back ;)

Yes this is a great project for me, and I did restore com.samsung.android.allshare.service.fileshare and now wifi Direct is working again. Thanks mate, keep up this great work brother ;)
 
  • Like
Reactions: w1nst0n_fr

w1nst0n_fr

Member
Dec 27, 2019
45
72
gitlab.com
@w1nst0n_fr thank you. My first post was not about debloating custom rom from GApps. It was a general question: is the debloater an alternative approach to get a 99% Google free phone. My answer: yes, but you need some luck. You can't know how your phone performs afterwards. For custom rom there are tons of reports for each device.

Oh ! I misread you first post actually. You were talking about Gapps free phone. I understand better now!

IMO the most reliable and safest way to get a 99% Google free phone is to install an AOSP custom ROM without Gapps. For the 1% left you need to tinker with DNS, WebView, GPS... (this guide is not bad)

I insist on AOSP custom ROM because a stock-based custom ROM has the same issues as my script. The thing is it is not always possible to unlock the bootloader or to find an AOSP ROM for one's device. This why I created this script.

What is really tedious and not always simple is to document all the packages. There is a LOT of system packages whose the exact function is hard to determine and the consequence of their uninstallation very obscure. When I have the apk I can at least try to reverse-engineer to make some assumptions but it isn't bulletproof.

Yes this is a great project for me, and I did restore com.samsung.android.allshare.service.fileshare and now wifi Direct is working again. Thanks mate, keep up this great work brother ;)

Thanks. :)
 
Last edited:
  • Like
Reactions: kurtn

kurtn

Senior Member
Jan 28, 2017
3,932
1,692
Small town in Bavaria
Oh ! I misread you first post actually. You were talking about Gapps free phone. I understand better now!

IMO the most reliable and safest way to get a 99% Google free phone is to install an AOSP custom ROM without Gapps. For the 1% left you need to tinker with DNS, WebView, GPS... (this guide is not bad)

I insist on AOSP custom because a stock-based custom ROM has the same issues as my script. The thing is it is not always possible to unlock the bootloader or to find an AOSP ROM for his/her device. This why I created this script.
What is really tedious and not always simple is to document all the packages. There are a LOT of system packages whose the exact function is hard to determine and the consequence of their uninstallation very obscure. When I have the apk I can at least try to reverse-engineer to make some assumptions but it isn't bulletproof.



Thanks. :)
Nice promotion! "Hey this is second best" I see quite some advantages over aosp rom.
Better hardware support like camera or graphics acceleration.
Better security due to locked boot loader and latest patches in proprietary components.
Better stability - no hobbyists mess around.
 

rameshhelp

Member
Jan 27, 2017
6
2
hi developer
can u pls screenshot or youtube record the process please? im abit lost with the whole thing. i am aware how to use adb n remove manually bloatwares. unless u could provide the whole lists of bloatwares?
 
  • Like
Reactions: Nameless Foe

netcrk

Member
Jul 23, 2011
33
3
I did "install WSL (Windows Subsystem for Linux) in order to be able to use bash scripts and Install ADB. If you want ADB support everywhere on your PC, you need to add the path of the ADB folder in the system variables"
When i use bash app: bash debloat_script.sh and get error "debloat_script.sh: line 112: adb: command not found"
Plz help me, tnx
 

kurtn

Senior Member
Jan 28, 2017
3,932
1,692
Small town in Bavaria
I did "install WSL (Windows Subsystem for Linux) in order to be able to use bash scripts and Install ADB. If you want ADB support everywhere on your PC, you need to add the path of the ADB folder in the system variables"
When i use bash app: bash debloat_script.sh and get error "debloat_script.sh: line 112: adb: command not found"
Plz help me, tnx
At some point it's easier to run a real Linux system. Dual boot or live usb stick.
 

xradiation

Member
Apr 25, 2020
19
9
- hi guys, i would like to share this exported txt file from 'debloater' which i installed as a magisk module to debloat a samsung phone, in essence debloater works in the same way as the script in the main thread ( thanks @w1nst0n_fr ) other than it can be used locally in termux.
- it took me a while to get the phone to a stable state with multiple tries but i eventually managed to do it.
- I've managed to debloat most of samsung/google junk out including but not limited to google apps, i hope this will help ;)
 

Attachments

  • import-debloat.txt
    3 KB · Views: 265

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    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)


    Systemless debloat is the only solution for Android 10+ users because system can't be mounted in read-write anymore.

    Hi w1nst0n. You did a great job with your debloater script. Thanks for sharing it! Keep up the great work!

    It is possible to mount system as read-write in Android 10 and newer.

    There are 2 tools that can do this. My oldschool script and the new sophisticated superrepack tool by @munjeni
    1
    So I got it successfully running on my Huawei P20. I've ran the Huawei and the AOSP method.
    The phone got shipped with Netflix, Huawei Translator, Microsoft Swiftkey Keyboard and some Google Apps (Google Movies, Google Music).

    Is there a way I can remove them? The phone isn't rooted and won't be. :)
    1
    So I got it successfully running on my Huawei P20. I've ran the Huawei and the AOSP method.
    The phone got shipped with Netflix, Huawei Translator, Microsoft Swiftkey Keyboard and some Google Apps (Google Movies, Google Music).

    Is there a way I can remove them? The phone isn't rooted and won't be. :)
    Google and Microsoft are in an extra list
    GAFM
    1
    At least I got rid of the useless google music app (it's youtube music now) and the movie and book app. Thank you. But now I licked some blood with all the debloating and I still would like to remove Netflix, Microsoft Swift Keyboard (it didn't remove with the microsoft option in the script). How would I do that?

    And do you know by any chance which line of the code I would have to remove if I want to exclude YouTube from the google option?
    Each app has a unique identifier. YouTube is com.google.android.youtube
    Find that in the list and delete or comment out.
    Get the identifiers of Netflix and keyboard and add them to a list.
  • 39
    Universal Android Debloater

    [Logo to be created]


    Bash script using ADB to debloat rooted and non-rooted smartphones. Improve your privacy and increase your battery life.

    DISCLAIMER : Use this script 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. The script has a menu that lets you choose what debloat list you want to use. I strongly encourage you to take a look at the lists because the default selection may not suit you. All packages are as well documented as possible in order to provide a better understanding of what you can delete or not.

    This script should be safe with the default selection. The worse thing which could happen is preventing an essential system process to be loaded during boot causing then an unfortunate bootloop. If you used the non-root solution, 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!


    If you have a rooted device you can also physically delete the apks. Ironically this solution is safer because the script saves the apks before their removal. In case of bootloop you just need to run the script from a recovery with ADB support (e.g TWRP) and restore them.


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

    Features
    • Quick search among all the packages of an android device
    • Uninstallation of system/user packages (manually or with the debloat lists)
    • Reinstallation of system packages (manually or with the debloat lists)
    • ADB backup/restore (not really reliable, see the FAQ)
    • Device brand detection and auto-selection of the appropriate manufacturer debloat list
    • Logging: debloated_packages.txt, remaining_packages.txt, deleted_apks.txt (for root users)
    • Root support (system and systemless with Magisk)
    • Installation of alternative open-source apps replacing stock apps (list in the WIKI section) (Not yet : WIP)

    NB : The non-root method is NOT a real uninstallation for system apps (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
    • Huawei
    • Motorola
    • Nokia
    • OnePlus
    • Oppo
    • Samsung
    • Sony
    • Xiaomi

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

    Download

    How to use

    Acknowledgement
    3
    Hi,

    So I went through with the whole (well documented) debloating instructions and debloated everything there was to debloat until the script said "nothing to debloat :)" on every selectable option. [...] Now the phone wont boot anymore.
    [...] Is this a known issue already? I can be a tester if there are some fixes on the way.

    A new big release (v2.8) is coming soon.

    As for the bootloop, I'm sorry. It seems this only happens (for now) on newer Samsung devices with OneUI 3.0. This is a known issue (see #39). The faulty package seems to be a Google one but hasn't been found yet.

    Only users of those phones can identify it. I can't do anything alone. I would be delighted if you help me on this. Come over to Gitlab. It's easier to track issues. :)

    Any idea why the debloat script won't recognize that I've updated bash to the latest version and set it to default on my MacBook?
    Well... I dunno how I could have failed this but here it is:

    On the 4th line of code, in the if it should be:
    "${BASH_VERSINFO[0]}" < 5 instead of BASH_VERSINFO < 5

    It will be fixed in the next release.
    3
    How to contribute

    Fetch the list of all the system packages of your phone. My script automatically exports this list in a file called remaining_packages.txt after choosing any action in the main menu.

    1. Seek for new packages not present in my debloat lists. You can use this script to check if your list has no duplicate with the current lists in the repository.
    2. Try to document each new packages and create a new issue on Gitlab.

    How to decompile an APK

    - Apktool
    - Jadx (what I use)
    - Bytecode Viewer


    How to report bugs

    Open an issue on Gitlab and precisely explain the issue. Screenshot(s) can help.
    3
    -------------- 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
    3
    Happy new year!

    I wouldn't have thought this release would take me this long! Finally, here is the v2.8:


    The changelog is on Gitlab, as usual. This is the last major update for the bash script. I'm sure a lot of people will be happy to know that I added root support. You can even generate a flashable zip if you want!

    I am now focusing on developing a cross-platform GUI.

    EDIT: I reworked the logic behind the flashable zip generation. There was an issue. It is now much simpler and correctly works. I also added a backup of the apks before the flashable zip generation. It's safer.

    I released an hotfix (v2.8.1) with these changes.
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone