Android Tutorial Connect B4A to Bluestacks 5

Step 1. Copy the adb file path

- Locate the adb file in the SDK folder.
- Copy the adb file path

Path example: C:\B4A\sdk\platform-tools

Step 2. Connect the B4A adb with the emulator IP

- Open CMD as administrator
- Go to the path inside the CMD
- Carry out the command that connects the adb with the IP address of the emulator.

Command

) C:\B4A\sdk\platform-tools
) adb connect 127.0.0.1:555

The emulator IP is 127.0.0.1:5555
I don't know if it changes. If so, mention it in the comments and I'll show you where to see the emulator's IP.

Step 3. Activate the Android ADB debugging bridge

- Open the emulator
- Open the settings and go to the advanced section.
- Activate the option: Android ADB debugging bridge
- Save the changes.

Step 6. Start the connection with the IP from B4A

- Open B4A
- Open the Logs window
- Click on connect

Step 7. Recommendation

Make sure Bluestacks is open when you click release.
I tried clicking release when bluestacks is closed. But it doesn't open bluestacks.

Tutorial on youtube:
 

jroriz

Active Member
Licensed User
Longtime User
Thanks for the Tip.

To the best of my knowledge, step 6 is enough as B4A Detects Bluestacks and connects automatically.

All you have to do, in case it does not connect is to goto

Tools->Restart ADB Server
For some reason, in some PC configuration, BS only works with this workaround...
 

hatzisn

Well-Known Member
Licensed User
Longtime User
Thanks a lot. Add this IDE hyperlink to your app main class (or B4XMainPage) to do it directly:

B4X:
'Ctrl + click to connect to BlueStacks: ide://run?file={path to sdk platform tools}\adb.exe&args=connect&args=127.0.0.1:5555
 

hatzisn

Well-Known Member
Licensed User
Longtime User
I do not know if it is my system, but if you close bluestacks while adb is connected to it, everything hangs. If you disconnect first the adb then everything is fine. Maybe you should consider adding also this IDE hyperlink to your app main class (or B4XMainPage) to do it also directly:

B4X:
'Ctrl + click to connect to BlueStacks: ide://run?file={path to sdk platform tools}\adb.exe&args=disconnect
 
Top