Android Tutorial Using CustomBuildAction to deploy to multiple devices at once

This tutorial will demonstrate how you can use CustomBuildAction attribute to deploy to multiple connected devices at once.

The "additional" devices should be connected in USB debug mode. This allows us to call the adb tool, which is part of Android SDK, to install the package and run it on each of the devices.

We will limit this feature to release deployments as debug deployments must run with a device that is actively connected to the IDE.

The first step is to find the IDs of the connected device by running adb devices:


In this case we have two devices connected through ADB (one of them is the emulator) and another device connected with B4A-Bridge.

We need to add two build actions for each device. One action will install the APK and the second will run it.

The actions will be added before the installation step (step #4).

   #CustomBuildAction: 4, c:\android-sdk-windows7\platform-tools\adb.exe, -s emulator-5554 install -r 1.apk
   #CustomBuildAction: 4, c:\android-sdk-windows7\platform-tools\adb.exe, -s emulator-5554 shell am start -a android.intent.action.MAIN -n b4a.example/.main -f 0x10000000 -c android.intent.category.LAUNCHER
   #CustomBuildAction: 4, c:\android-sdk-windows7\platform-tools\adb.exe, -s 04cf0a951c8934fc install -r 1.apk
   #CustomBuildAction: 4, c:\android-sdk-windows7\platform-tools\adb.exe, -s 04cf0a951c8934fc shell am start -a android.intent.action.MAIN -n b4a.example/.main -f 0x10000000 -c android.intent.category.LAUNCHER
#End If
There are four values that you need to update in the above code:
- full path to adb.exe
- device serial name after -s parameter
- The apk file name (here it is 1.apk)
- The package name (here it is b4a.example)

In the device selection dialog we will choose the B4A-Bridge connected device:


Now we can easily test the same app on multiple connected devices.
Last edited:


Active Member
Licensed User
Longtime User

Dear All,

you may use also this small little software attached to let the IDE connect to many devices at once. This what I am using to overcome with the connecting to multiple devices at once. Transfer of APKs is working fine.

You need Wifi and the B4A-Bridge Plus to let it work.

Let your IDE connect to IP (localhost) and than you will start the B4A-Bridge Plus-App on each device. They will add themself to the Multibridge and so to the IDE.

If a device is no longer connected than just press 'F2' in the IDE or press the stop and start button on the device to re-connect.

As you see the software is in the middle of its way to be ready for all features.
Funny things you will see by using the designer. This is not completed so far, as well as the Rapide developer. This is tricky and needs some more Titel, therefore the version number is below 1.0!
The software was done in VB6 so you will need the dlls of VB6. If you don't have that I may send you the Installation-Version of this software via PM since the size will exceed the upload limit.

Bye4now, Gunther


    71.4 KB · Views: 1,032
Last edited:


Active Member
Licensed User
Longtime User
Although this thread is old, I just encountered the problem of not being able to connect adb over usb, and want to share the helpful information I found.
I'm using a new Windows 10 computer, and in my case, my LG G6.
Although everything was set up according to searched information in the forum, I needed to set my phone in Charging Only mode.

This helped
Last edited:

Similar Threads

  • Article
Android Code Snippet CustomBuildAction
Deleted member 103