STF connected mobile + Docker version of CentOS7/8

Posted by nekoanz on Fri, 12 Nov 2021 12:46:12 +0100

prerequisite:
CentOS8 has configured the STF environment
or
CentOS7 installs STF, Docker version
Windows view adb version

C:\Users\shenyf>adb --version
Android Debug Bridge version 1.0.41
Version 31.0.3-7562133
Installed as D:\android-sdk-windows\platform-tools\adb.exe

Method 1: connect mobile phone on STF service

Just plug the debugging mobile phone into the computer

Method 2: connect mobile phones on other computers on STF service

1. Run on the windows machine, start the adb server and expose the 5037 port

Startup error: find the following problem 1

ADB lower version (version 1.0.32 or below)

adb -a -P 5037 fork-server server 

ADB higher version (above version 1.0.32)

adb nodaemon server -a -P 5037

2. Execute the following command on the STF service computer terminal, - adb host is followed by the connected computer IP, and other IPS are STF service computer IP

stf provider --name local --min-port 7400 --max-port 7700 --connect-sub tcp://127.0.0.1:7114 --connect-push tcp://127.0.0.1:7116 --group-timeout 20000 --public-ip 192.168.31.15 --storage-url http://192.168.31.15:7100/ --adb-host 192.168.10.160 --adb-port 5037 --vnc-initial-size 720x1280 --allow-remote  

After the above operation is successful, you can see the connected mobile phone on the web page, and it can be used normally in the mobile browser

Method 3: STF (Docker version) is connected to the mobile phone

Just plug the debugging mobile phone into the computer

Mode 4: STF (Docker version) is connected to mobile phones on other computers

1. Run on the windows machine, start the adb server and expose the 5037 port

Startup error: find the following problem 1

ADB lower version (version 1.0.32 or below)

adb -a -P 5037 fork-server server 

ADB higher version (above version 1.0.32)

adb nodaemon server -a -P 5037

2. View the docker process number of stf (stf must be running)

[root@bogon ~]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
f349984bf935        openstf/stf         "stf local --publi..."   16 hours ago        Up 6 seconds                            stf
3b7be288d1ff        sorccu/adb:latest   "/sbin/tini -- adb..."   16 hours ago        Up 48 minutes                           adbd
a4bfb45049e4        rethinkdb           "rethinkdb --bind ..."   16 hours ago        Up 48 minutes                           rethinkdb

Enter the docker container

[root@bogon ~]# docker exec -it f349984bf935 /bin/sh

Run the following command inside the container to run the stf service

$ stf local --public-ip 192.168.111.129 --allow-remote

3. Inside the container, load the devices on the windows host through adb host:
When you don't know how to write the command, run the STF service above to find a line with a provider in the log, which can compare how to write the content

Copy it

provider --name bogon --min-port 7400 --max-port 7700 --connect-sub tcp://127.0.0.1:7114 --connect-push tcp://127.0.0.1:7116 --group-timeout 900 --public-ip 192.168.111.129 --storage-url http://localhost:7100/ --adb-host 127.0.0.1 --adb-port 5037 --vnc-initial-size 600x800 --mute-master never --allow-remote

Modify the above command, check the ip address of Windows computer and replace it with – ADB host; During the command execution, you need to manually click [agree to install STFService] at the mobile phone endpoint

If the ip address is wrong, an error will be reported. Find problem 2
Other errors, find problem 3

stf provider --name bogon --min-port 7400 --max-port 7700 --connect-sub tcp://127.0.0.1:7114 --connect-push tcp://127.0.0.1:7116 --group-timeout 900 --public-ip 192.168.111.129 --storage-url http://localhost:7100/ --adb-host 192.168.10.160 --adb-port 5037 --vnc-initial-size 600x800 --mute-master never --allow-remote

Use Ctrl+D in the docker container to exit the container, but this will stop the container.
If you want to exit the container but do not want the container to stop, use Ctrl+P+Q

complete


Problem encountered 1

C:\Users\shenyf>adb devices
List of devices attached
P7CDU1xx29xx8778        device


C:\Users\shenyf>adb nodaemon server -a -P 5037
adb F 11-12 09:56:30 82508 76496 main.cpp:160] could not install *smartsocket* listener: cannot bind to 0.0.0.0:5037: Connect the scrubbing area with each other€(Agreement/Network address/DandyMouth)NumberPurchase orderㄤYi Rao°€?(10048)

Solution: click allow in the pop-up window

C:\Users\shenyf>adb kill-server

C:\Users\shenyf>adb nodaemon server -a -P 5037
adb I 11-12 10:07:04 80976 82508 auth.cpp:417] adb_auth_init...
adb I 11-12 10:07:04 80976 82508 auth.cpp:152] loaded new key from 'C:\Users\shenyf\.android\adbkey' with fingerprint 9C2720CF739665AC55237E07DA23A3DE002FB9275DD1044106B23F59E1FA892D
adb I 11-12 10:07:04 80976 82032 transport.cpp:333] P7CDU1xx29xx8778: read thread spawning
adb I 11-12 10:07:04 80976  6436 transport.cpp:305] P7CDU1xx29xx8778: write thread spawning
adb I 11-12 10:07:04 80976 82508 transport.cpp:1596] fetching keys for transport P7CDU1xx29xx8778
adb I 11-12 10:07:04 80976 82508 auth.cpp:469] Calling send_auth_response
adb I 11-12 10:07:04 80976 82508 adb.cpp:175] P7CDU1xx29xx8778: offline

Encountered problem 2

$ stf provider --name bogon --min-port 7400 --max-port 7700 --connect-sub tcp://127.0.0.1:7114 --connect-push tcp://127.0.0.1:7116 --group-timeout 900 --public-ip 192.168.111.129 --storage-url http://localhost:7100/ --adb-host 192.168.111.1 --adb-port 5037 --vnc-initial-size 600x800 --mute-master never --allow-remote
2021-11-12T02:20:49.400Z INF/provider 242 [*] Subscribing to permanent channel "g0OY50XgThizL0Ce0pjDCQ=="
2021-11-12T02:20:49.451Z INF/provider 242 [*] Sending output to "tcp://127.0.0.1:7116"
2021-11-12T02:20:49.455Z INF/provider 242 [*] Receiving input from "tcp://127.0.0.1:7114"
Unhandled rejection Error: connect ETIMEDOUT 192.168.111.1:5037
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)

terms of settlement
win+r open black window

1. If the machine is connected with a wireless network card, find the IPv4 address of the WLAN adapter WLAN
2. If the local machine is connected to a network cable network card, find the IPv4 address of the local connection

C:\Users\shenyf>ipconfig

Windows IP to configure


WLAN adapter local connection* 4:

   Media status  . . . . . . . . . . . . : Media disconnected
   Connect specific DNS suffix . . . . . . . :
   
WLAN adapter WLAN:

   Connect specific DNS suffix . . . . . . . : GE4
   Local link IPv6 address. . . . . . . . : fe80::xxxx:xxxx:xxxx:ce4e%6
   IPv4 address . . . . . . . . . . . . : 192.168.10.160
   Subnet mask  . . . . . . . . . . . . : 255.255.254.0
   Default gateway. . . . . . . . . . . . . : 192.168.10.1

Encountered problem 3

2021-11-12T02:25:38.578Z FTL/device 426 [P7CDU1xx29xx8778] Setup had an error Error: /data/local/tmp/STFService.apk could not be installed [INSTALL_FAILED_ABORTED: User rejected permissions]
    at /app/node_modules/adbkit/lib/adb/command/host-transport/install.js:28:23
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)
2021-11-12T02:25:38.578Z FTL/util:lifecycle 426 [P7CDU1xx29xx8778] Shutting down due to fatal error
2021-11-12T02:25:38.603Z INF/provider 262 [*] Cleaning up device worker "P7CDU1xx29xx8778"
2021-11-12T02:25:38.603Z ERR/provider 262 [*] Device worker "P7CDU1xx29xx8778" died with code 1

Solution: check whether the phone pops up and install it manually
Reason: STFService.apk cannot be installed

Topics: Linux CentOS Docker