Tool BridgeCLI - Command line tool for B4A-Bridge

Erel

Administrator
Staff member
Licensed User
BridgeCLI is a command line B4A-Bridge manager written in B4J.

It allows developers to install release APKs through the command line.
You can use it to deploy applications on multiple devices.
It should work on Mac and Linux as well as Windows (It was only tested on Windows).

You should run B4A-Bridge v2.3+ on the devices.

It can use the auto discovery feature to find devices.
To list the discovered devices:
B4X:
java -jar BridgeCLI.jar -Discover
Output:
192.168.0.5 - LGE Nexus 5
192.168.0.9 - LGE Nexus 5X

The second supported feature is -Install. You need to pass the APK file and it will install it.
B4X:
java -jar BridgeCLI.jar -Install "C:\Users\H\Documents\B4A Samples\Objects\1.apk"
In this case it will install it on the first device found.
You can add -Ip to select the ip address (instead of auto discover):
B4X:
java -jar BridgeCLI.jar -Install "C:\Users\H\Documents\B4A Samples\Objects\1.apk" -Ip 192.168.0.5
You can add -Name to select one of the discovered devices:
B4X:
java -jar BridgeCLI.jar -Install "C:\Users\H\Documents\B4A Samples\Objects\1.apk" -Name "LGE Nexus 5X"
The B4J source code is attached.

Tips:

- Make sure that the device is not connected to the IDE with B4A-Bridge when using this tool. Otherwise the IDE will "steal" the connection and the transfer will be broken.
 

Attachments

Last edited:

Erel

Administrator
Staff member
Licensed User
How about implementing something like "-Install <apk file path> -all"?
I will add such a feature in the future.

For now you can create a batch file that sends to multiple ip addresses or a simple B4J program that calls Discover and then sends to all addresses.
 

Claudio Oliveira

Active Member
Licensed User
I will add such a feature in the future.

For now you can create a batch file that sends to multiple ip addresses or a simple B4J program that calls Discover and then sends to all addresses.
This should also work out fine.
Thanks Erel.
 

victormedranop

Well-Known Member
Licensed User
I will add such a feature in the future.

For now you can create a batch file that sends to multiple ip addresses or a simple B4J program that calls Discover and then sends to all addresses.
I'm waiting for that !!

amazing
 

LucaMs

Expert
Licensed User
I'm waiting for the following feedback from users who test it with multiple devices: do you see all the devices listed when you run
B4X:
java -jar BridgeCLI.jar -Discover
?
None.
I have 2 devices (Android 4.4.2 and 7.0) with Bridge 2.54 running
 

LucaMs

Expert
Licensed User
Might be a firewall issue. Anyway you should write the explicit IP address instead...
Even disabling my firewall... nothing.

Using the IP it's ok.

I should study the source code (BTW I do not see, in the code, where (and how) the log of discovered devices should occur); surely the classic 192.168... is not mandatory, right?
 

LucaMs

Expert
Licensed User
surely the classic 192.168... is not mandatory, right?
B4X:
Private Sub Timer1_Tick
    Log("Broadcast Address: " & udpsocket.GetBroadcastAddress)
    Dim p As UDPPacket
    p.Initialize(Array As Byte(0), udpsocket.GetBroadcastAddress, port)
    udpsocket.Send(p)
End Sub
the log is:
Broadcast Address: 192.168.56.255

My lan does not start with 192.168
 

LucaMs

Expert
Licensed User
p.Initialize(Array As Byte(0), udpsocket.GetBroadcastAddress, port)
Setting directly "my host" - xxx.xxx.xxx.255, instead of "udpsocket.GetBroadcastAddress" it founds the devices.

(I found somewhere that a problem exists with GetBroadcastAddress and Windows 7).
 
Top