Skip to content

Instantly share code, notes, and snippets.

@samchoi69
Forked from CHEF-KOCH/Remove BlueStacks Ads
Last active February 22, 2025 02:09
Show Gist options
  • Save samchoi69/75d9bd164597338ff116b5a441e41a83 to your computer and use it in GitHub Desktop.
Save samchoi69/75d9bd164597338ff116b5a441e41a83 to your computer and use it in GitHub Desktop.
Remove BlueStacks Ads
# Windows
1. Open Windows Command Prompt
2. Run command
"C:\Program Files (x86)\BlueStacks\HD-Adb.exe" shell
# Within BlueStacks shell
/system/xbin/bstk/su
pm disable-user com.bluestacks.s2p
# macOS
1. Open Terminal
2. Run command:
/Applications/BlueStacks.app/Contents/MacOS/adb shell
# Within BlueStacks shell
/system/xbin/bstk/su
pm disable-user com.bluestacks.s2p
# Error: device not found
# Kill the server with ADB
# Make sure BlueStacks is running before you try to start ADB and disable the user
# Windows
"C:\Program Files (x86)\Bluestacks\HD-Adb.exe" kill-server
#macOS
/Applications/BlueStacks.app/Contents/MacOS/adb kill-server
@Sayyid01
Copy link

Sayyid01 commented Apr 2, 2020

Hi, i've got error like this when I try it
Error: java.lang.IllegalArgumentException: Unknown package: com.bluestacks.s2p
Can you help?

@larryl79
Copy link

Hi, i've got error like this when I try it
Error: java.lang.IllegalArgumentException: Unknown package: com.bluestacks.s2p
Can you help?

I've got a same issue
(Bluestack4)

@bopeuph
Copy link

bopeuph commented Jun 16, 2020

My version of Bluestacks does not have HD-Adb.exe. What would be the comparable filename? I don't have anything with Adb as a task.

@DBurca
Copy link

DBurca commented Oct 9, 2020

Whenever I start the daemon, it starts, then after a few seconds it says error: closed. I'm not sure what to do, and I have even restarted the server a few times. I am running bluestacks 4

@yukpun
Copy link

yukpun commented Oct 31, 2020

Whenever I start the daemon, it starts, then after a few seconds it says error: closed. I'm not sure what to do, and I have even restarted the server a few times. I am running bluestacks 4

Same issue. Is there a solution?

Copy link

ghost commented Dec 7, 2020

Whenever I start the daemon, it starts, then after a few seconds it says error: closed. I'm not sure what to do, and I have even restarted the server a few times. I am running bluestacks 4

same issue

@arshit09
Copy link

arshit09 commented Jan 2, 2021

Error: java.lang.IllegalArgumentException: Unknown package: com.bluestacks.s2p

Whenever I start the daemon, it starts, then after a few seconds it says error: closed. I'm not sure what to do, and I have even restarted the server a few times. I am running bluestacks 4

Go to BLuestack's Settings > Preferences > "Enable Android Debug Bridge" (Enable this option.)

@DBurca
Copy link

DBurca commented Jan 3, 2021

Now, when I get into the daemon, I can do cd system/xbin/bstk and I get into that directory. However, when I type system/xbin/bstk/su it does not recognize that directory, even though I can run ls to list the available paths, and I see su in there. In other words, I cannot get into the su directory. Don't know what to do, I think that OP should have given more explanation.

@Learn000
Copy link

Whenever I start the daemon, it starts, then after a few seconds it says . I'm not sure what to do, and I have even restarted the server a few times. I am running bluestacks 4error: closed

i have this problem too

Copy link

ghost commented Jan 13, 2021

Maybe get root by this link and try running the above except replacing /system/xbin/bstk/su to su?
Shoot, still does not work because package does not exist, maybe Bluestacks patched this?

@MarshMeadow
Copy link

we need an updated version..

@robbert1978
Copy link

robbert1978 commented Dec 23, 2024

This is the new method that I used
First, you need to install WSL or Linux VM. I used WSL.

Open WSL in C:\ProgramData\BlueStacks_nxt\Engine\Pie64:

cd /mnt/c/ProgramData/BlueStacks_nxt/Engine/Pie64
sudo modprobe nbd
sudo qemu-nbd -c /dev/nbd0 Root.vhd 
sudo debugfs -w /dev/nbd0p1

( If you dont't have qemu-nbd and debugfs, try to install it via apt. )

Now we see, we can edit Root.vhd :
type ls:
image

In debugfs prompt:

cd android
dump ./system/etc/hosts /tmp/hosts

It will dump ./system/etc/hosts of Root.vhd to /tmp/hosts of your Linux machine.

Edit /tmp/hosts:

127.0.0.1       localhost
::1             ip6-localhost
127.0.0.1       coinhive.com
127.0.0.1 adservice.google.com
127.0.0.1 pagead2.googlesyndication.com
127.0.0.1 googleads.g.doubleclick.net
0.0.0.0 cloud.bluestacks.com
0.0.0.0 cloud-api-cdn.bluestacks.com
0.0.0.0 cdn-icon.bluestacks.com
0.0.0.0 cdn-bgp.bluestacks.com
0.0.0.0 bluestacks.com
0.0.0.0 www.bluestacks.com

In debugfs prompt:

unlink ./system/etc/hosts
write /tmp/hosts ./system/etc/hosts
q

Use:

sudo qemu-nbd -d /dev/nbd0

to detach the disk file.

Now we see the ads is removed.

image

Update:

You can disable its own laucher by running:

pm disable-user com.uncube.launcher3

But before doing it, remember to install alternative laucher ( like Nova ).

I recommend this.

Notice

Why I know those hosts:

I used Http Toolkit to hook https requests of Bluestack launcher app:

image

@excalibur1010
Copy link

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