Skip to content

Instantly share code, notes, and snippets.

@TameemS
Last active October 12, 2024 21:44
Show Gist options
  • Save TameemS/894cdb8adae1d6042a5f21c4e80bcd9e to your computer and use it in GitHub Desktop.
Save TameemS/894cdb8adae1d6042a5f21c4e80bcd9e to your computer and use it in GitHub Desktop.
Debloating LDPlayer

Inspired by this

More of my guides: Debloating MEMu - Debloating Nox (Updated)

This mainly applies to LDPlayer9. They will probably work on the low end options (like LDPlayer5) but not guaranteed.

Debloating LDPlayer

This emulator seems to have less stability issues than MEMu. I think we get the shtick that these emulators do spooky stuff.

  1. Download LDPlayer, preferably an offline version from the version history
  2. Go to LDPlayer Settings, make system.vmdk writable, go to Other Settings and enable Root Permission
  3. I would suggest getting off of LD's Launcher. Go get another one and set it as a default home app.
  4. Get a file manager that supports root, go to the root directory, then delete /system/priv-app/LDAppStore and /system/app/Launcher3. (why did they modify the AOSP launcher lol)
  5. Get AdAway and set it up, preferably with root-based blocking.
  6. Open C:\Windows\System32\drivers\etc\hosts with a text editor of your choice and add this in
0.0.0.0 encdn.ldmnq.com.w.alikunlun.com
0.0.0.0 apien.ldmnq.com
0.0.0.0 advertise.ldplayer.net.a.lahuashanbx.com
0.0.0.0 d19przo9d3f9zk.cloudfront.net
0.0.0.0 dldgmpfyeblzc.cloudfront.net
0.0.0.0 ins-o9iydzqn.ias.tencent-cloud.net
0.0.0.0 appstore.ldmnq.com
0.0.0.0 netease-publish-gdlgphs.w.alikunlun.com
0.0.0.0 d330if318qxsm2.cloudfront.net
0.0.0.0 dn2sifz9m7tkk.cloudfront.net
0.0.0.0 d3p6x1jquzbe0c.cloudfront.net
0.0.0.0 de2pmm85odupd.cloudfront.net
0.0.0.0 p-sgsg00.kxcdn.com
0.0.0.0 adabdapi.ldmnq.com
0.0.0.0 lden.oss-ap-southeast-1.aliyuncs.com
0.0.0.0 middledata.ldmnq.com
0.0.0.0 alb-fc2psc581f288qx1e4.cn-shanghai.alb.aliyuncs.com
0.0.0.0 www.google-analytics.com

(Most of these domains are according to Glasswire. If there are any more to block, tell me in the comments)

  1. Block dnplayer.exe in the firewall

And block the IP addresses using the files attached to this gist (original courtesy of ehindiayleau). Make sure both the batch and the text file are in the same folder! Open command prompt as admin and CD to the folder where you saved the two files.

Now let's install Magisk! (optional). Make sure you kept root on during all of this.

  1. Download Magisk Delta
  2. Launch it and allow everything it throws at you
  3. Directly install to system partition (you may need to relaunch the app for this option)
  4. Reboot, go to a root-supported file manager and delete /system/xbin/su to avoid conflicts and reboot again.
  5. That's about it. Go crazy

As far as I know there aren't any known ways to get around the SafetyNet detection. I've tried the usual methods that I use on my rooted phone and they didn't work. If you found a solution, please comment below! At the moment, SafetyNet requirements do not seem to pose a big threat and devs do use workarounds so that everyone can play no matter which platform (e.g. multiplayer games putting you in emulator lobbies).

@echo off
if "%1"=="list" (
netsh advfirewall firewall show rule ld_ip_to_fw_rule | findstr RemoteIP
exit/b
)
netsh advfirewall firewall delete rule name="ld_ip_to_fw_rule"
for /f %%i in (ld_block.txt) do (
netsh advfirewall firewall add rule name="ld_ip_to_fw_rule" protocol=any dir=in action=block remoteip=%%i
netsh advfirewall firewall add rule name="ld_ip_to_fw_rule" protocol=any dir=out action=block remoteip=%%i
)
call %0 list
pause
79.133.177.0-79.133.177.255,163.181.56.0-163.181.56.255,163.181.92.0-163.181.92.255,47.74.196.235,139.224.223.140,106.14.57.193,139.196.27.122,106.15.125.201,47.74.196.239
@TrialMacameau
Copy link

TrialMacameau commented May 15, 2023

Again it does involve deleting folders off the emulator which can be reinstalled upon upgrades to the software and if you can't remove these 2 mentioned folders due to Read Only despite having Root Permission enabled, you can Freeze them using Titanium Backup : https://drive.google.com/file/d/1KXARgGteRzFBd_rs77g19S31pag-R3E9/view?usp=share_link

@DABnoREGRET
Copy link

You missed the quotation marks in the bat file.

for /f %%i in ("ld_block.txt") do (

@TameemS
Copy link
Author

TameemS commented Jul 5, 2023

You missed the quotation marks in the bat file.

for /f %%i in ("ld_block.txt") do (

Shit thanks for pointing that out lol

@TameemS
Copy link
Author

TameemS commented Jul 5, 2023

Actually no im fucking tired. it was correct before lol. this is batch not java

@JaxemMax
Copy link

great guide! but i noticed that after following all the steps ldplayer still seems to connect to the following domains:
lden.oss-ap-southeast-1.aliyuncs.com
middledata.ldmnq.com

@TameemS
Copy link
Author

TameemS commented Jul 27, 2023

great guide! but i noticed that after following all the steps ldplayer still seems to connect to the following domains: lden.oss-ap-southeast-1.aliyuncs.com middledata.ldmnq.com

Alright, thanks for pointing that out. Added those domains and its associated IPs according to DNS lookup.

@JaxemMax
Copy link

sorry for asking this super late but does the domain "encdn.ldmnq.com.w.alikunlun.com" also block "encdn.ldmnq.com" when using windows hosts file

@TameemS
Copy link
Author

TameemS commented Aug 27, 2023

sorry for asking this super late but does the domain "encdn.ldmnq.com.w.alikunlun.com" also block "encdn.ldmnq.com" when using windows hosts file

Yes, encdn.ldmnq.com redirects to encdn.ldmnq.com.w.alikunlun.com which is blocked anyway. But you could add it in hosts just in case.

@JaxemMax
Copy link

sorry for asking this super late but does the domain "encdn.ldmnq.com.w.alikunlun.com" also block "encdn.ldmnq.com" when using windows hosts file

Yes, encdn.ldmnq.com redirects to encdn.ldmnq.com.w.alikunlun.com which is blocked anyway. But you could add it in hosts just in case.

cool, thanks for the reply!

@gogcwy
Copy link

gogcwy commented Aug 30, 2023

Need add Rootless Launcher first replace Launcher3

otherwise stop here

Tablet is starting...

@JingAr87
Copy link

JingAr87 commented Mar 2, 2024

I figured out a way to customize the startup ad, go to Appdata\Roaming\XuanZhi9\cache and remove everything that isn't app icons that you have installed. Then start LDplayer to get a new ads for the ease of modifying, then close the emulator. then you open up ldadconfig.data and change the following : effectiveTime to 999999999, change all cdn.ldplayer.net to localhost, action_content to whatever. Then find any image of your liking and rename it to follow the existing 2 image files and delete those 2 files. Then make the ldadconfig.data and the image files read only to prevent their dirty servers from touching the file and you should be golden. Only thing i cannot figure out is how to change what the button does inside of the emulator. I changed action_content to youtube.com but inside the emulator it still links to the previous adware URL. I hope this helps.

@Zenix-Al
Copy link

Zenix-Al commented Mar 5, 2024

there's more to block actually, since ldplayer isnt 100% rely on ldplayer.exe, but also oracle vm vbox, since i use firewall and able to monitor the internet, but it depends on your app on your ldplayer itself. here's some of the list :

encdn.ldplayer.com, apiid.ldmnq.com, ad.ldplayer.net, middledata.ldmnq.com
if youre interested what firewall im using, im using portmaster, it also block filter list like adblock did and you get full control over your network.

@MrRubberDucky
Copy link

was bored, here's my findings

  • LDPlayer9 uses Private DNS by default (can be turned off in Android settings)
  • LDPlayer9's Android can be quite talkative which needs to be blocked via DNS or whatever, mostly on android side and I guess windows side hosts is enough

here's a list of domains I got from doing the things in the emu using AdGuard Home. You don't need a Pi-Hole or AGH to apply this but you would need a DNS blocker that accepts filter lists, including user made like personalDNSfilter, DNS66 and so on.

hmma.baidu.com
ad.ldplayer.net
apiid.ldmnq.com
apien.ldmnq.com
ldcdn.ldmnq.com
en.ldplayer.net
encdn.ldmnq.com
api.ld-space.com
openrcv.baidu.com
storeen.ldmnq.com
usersdk.ldmnq.com
appstore.ldmnq.com
encdn.ldplayer.com
adabdapi.ldmnq.com
graph.facebook.com
android.bugly.qq.com
middledata.ldmnq.com
advertise.ldplayer.net
middledata.ldplayer.net
dldgmpfyeblzc.cloudfront.net
dn2sifz9m7tkk.cloudfront.net
de2pmm85odupd.cloudfront.net
dkf29paj6y8sk.cloudfront.net
d19przo9d3f9zk.cloudfront.net
d330if318qxsm2.cloudfront.net
d3p6x1jquzbe0c.cloudfront.net
encdn.ldmnq.com.w.alikunlun.com
ins-o9iydzqn.ias.tencent-cloud.net
lden.oss-ap-southeast-1.aliyuncs.com
netease-publish-gdlgphs.w.alikunlun.com
advertise.ldplayer.net.a.lahuashanbx.com

Not sure about these domains since they may have been caught in a cross-fire while testing but if you see similar then it's probably good idea to block them

p-sgsg00.kxcdn.com
alb-fc2psc581f288qx1e4.cn-shanghai.alb.aliyuncs.com

@825i
Copy link

825i commented Jul 15, 2024

Ok so here's what I've done to debloat LDPlayer as much as possible. As I just want to use it for a few Android apps which are not available on PC. Like my beloved Dwell app for listening to The Bible.

  1. Install latest version of LDPlayer 9 (I couldn't find existence of any "offline" version)
  2. Enable writeable system and root as told in above guide steps
  3. Download Aurora Store from AuroraOSS
  4. Drag the .apk into the emulator and install it
  5. Install Nova Launcher and any other apps I am interested in using Aurora
  6. Newer LDPlayer9 blocks access to /system/priv-app/LDLauncher3 etc. so no point even trying to delete it
  7. Make Nova Launcher the default launcher
  8. Go to Android System Settings > DNS > Enable my own NextDNS config which blocks millions of advertising and spyware domains.
  9. Go to Windows hosts file and add the domains in that @MrRubberDucky listed (thanks for that)
  10. Disable system writable and root.

That's what I did and it seems to be pretty good. No ads cancer on the launcher. Back button uses Nova and not LDLauncher3. Using NextDNS to sniff all the DNS requests, I see after swapping the launcher and blocking everything in hosts. The only other requests that are being passed to the internet after about 30 minutes are just:

android.apis.google.com
www.googleapis.com
fbcdn.net
www.instagram.com
ebaystatic.com

The last 3 are the result of accidentally opening Chrome where it tries to load the favicons from the "favourites" crapware bookmarks that chrome ships with by default. I replaced Chrome with Kiwi Browser via Aurora which allows me to run userscripts.

I have not and will not use a Google account with this. Aurora Store runs anonymously without an account.

Most of the advertising garbage is baked into their horrible store (we replaced with Aurora Store) and their launcher (we replaced with Nova).

I don't generally think this is less stable than MEmu. All of these Android crapware emulators are owned by the same Chinese megalith. You can tell just from their matching UI/UX and even the websites all look the same. See for yourself:

image

Screenshot 2024-07-15 101144
Bluestacks fastest and lightest huh? Lmao it's 7.7GB just for starters...

They all look something like the above. I settled on LDPlayer9 after MEmu kept skipping audio and for listening to bible this is infuriating. If you can't use LDPlayer9 try MEmu as it at least has an offline installer. Though don't expect it to not mine bitcoin or whatever in the background. You still need to follow similar steps as above and decrapify the entire thing.

Task Manager also shows that LDPlayer9 seems to now be behaving and taking about half the memory and a quarter of the CPU usage.

Screenshot-2024-07-15-102318.png

@825i
Copy link

825i commented Jul 15, 2024

Ok so I forked this and edited it for readability: https://gist.github.com/825i/b010adc28544b9e5868a0f4617bb325e

@TameemS
Copy link
Author

TameemS commented Jul 15, 2024

Install latest version of LDPlayer 9 (I couldn't find existence of any "offline" version)

You can still get the latest offline version from the version history
Do you have any issues accessing it?

@melutovich
Copy link

@TameemS Are their any updates mentioned in these comments like recently from @825i not yet included in your gist above?

@Red0Hood
Copy link

Red0Hood commented Aug 3, 2024

i made easy guide here where it change the start image with any image you like and block ads using your host list

@Achyuth072
Copy link

@825i

Install latest version of LDPlayer 9 (I couldn't find existence of any "offline" version)

You can still get the latest offline version from the version history Do you have any issues accessing it?

I mean no version says its the offline version or is it that all of them are offline version?

@TameemS
Copy link
Author

TameemS commented Aug 23, 2024

@825i

Install latest version of LDPlayer 9 (I couldn't find existence of any "offline" version)

You can still get the latest offline version from the version history Do you have any issues accessing it?

I mean no version says its the offline version or is it that all of them are offline version?

All of them are offline

@825i
Copy link

825i commented Aug 23, 2024

Hello. Please don't quote my name lol unless you mean to actually reply to me. It just results in email spam even if I have disabled notifications :(

So please remove @825i from any of your comments.

Thanks! <3

@TameemS
Copy link
Author

TameemS commented Aug 23, 2024

Hello. Please don't quote my name lol unless you mean to actually reply to me. It just results in email spam even if I have disabled notifications :(

Thanks!

Ah, I apologize

@Achyuth072
Copy link

@825i

Install latest version of LDPlayer 9 (I couldn't find existence of any "offline" version)

You can still get the latest offline version from the version history Do you have any issues accessing it?

I mean no version says its the offline version or is it that all of them are offline version?

All of them are offline

Ok cool thanks! I think you meant to quote me.

@TameemS
Copy link
Author

TameemS commented Aug 23, 2024

Install latest version of LDPlayer 9 (I couldn't find existence of any "offline" version)

You can still get the latest offline version from the version history Do you have any issues accessing it?

I mean no version says its the offline version or is it that all of them are offline version?

All of them are offline

Ok cool thanks! I think you meant to quote me.

I did xd. You quoted me quoting him where I included the mention. I'll edit the one that mentions him.

@825i
Copy link

825i commented Sep 22, 2024

I updated my own gist because I had to do this again on a new Windows install.
I believe this is the fastest way to get this emulator set up for frequent and hassle-free use.
Bear in mind, it does add a few optional steps which I needed for my own use-case.

https://gist.github.com/825i/b010adc28544b9e5868a0f4617bb325e

🙏 PLEASE DO NOT "QUOTE REPLY" TO MY MESSAGE! 🙏
You can just comment below.

@ImGGAAVVIINN
Copy link

Hey, I love your guides on debloating emulators! Do you happen to know how to remove the massive, annoying ads that pop up when launching and using Mumu Player? It's the best emulator for running Android 12, but the ads are driving me crazy.

@HongYue1
Copy link

HongYue1 commented Oct 9, 2024

Hey, I love your guides on debloating emulators! Do you happen to know how to remove the massive, annoying ads that pop up when launching and using Mumu Player? It's the best emulator for running Android 12, but the ads are driving me crazy.

root + adaway

@ImGGAAVVIINN
Copy link

ImGGAAVVIINN commented Oct 10, 2024

root + adaway

What about the starting ads that fills the screen?
and the popup ads that show when the emulator finish running?

@TameemS
Copy link
Author

TameemS commented Oct 10, 2024

Hey, I love your guides on debloating emulators! Do you happen to know how to remove the massive, annoying ads that pop up when launching and using Mumu Player? It's the best emulator for running Android 12, but the ads are driving me crazy.

Same principle tbh
In the case of removing ads, record the connections using Glasswire, Fiddler, Wireshark, etc and add any sus one to a firewall or hosts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment