TL/DR: Android 11+ boxes require different ADB treatment and it may be impssible to use ADB as a means for their control...
Hi,
A while back I realized that my TV box was not going to work with myServer (in its currrent state) because it was running Android 11, and the ADB authentication scheme has changed...
I was working on trying to get it up and running now, and I've run into a myServer question/issue... I'll document my steps on this thread so others can hopefully get it working once it works for me.
What I've done so far
on the Android Box:
- Enable WIFI Debugging (as opposed to just ADB) on the Android
- Allow ADB debugging on the connected network (tick remember this network)
- Select "Pair with code" and make note of the IP, Port & 6 digit pin. Close the dialog box.
- Make note of the IP/Port that ADB is using (this may be different from the Port you noted above. It will be the same IP, however). (We'll call this PORTADB)
On myServer
- Access terminal (ssh or web terminal or equivalent)
- Download the updated ADB tools for Arm (raspberry pi) from:
github.com/lzhiyong/android-sdk-tools/releases
- unzip and replace the folder /home/allonis/applications/platform-tools with the folder from the archive (I renamed my old platform-tools to keep as a backup)
- run "adb kill-server"
- run "adb pair IP:PORT" (then enter the pin code when requested - the Pin, IP and Port are the ones you got on the Android Box above).
- run "adb connect IP:PORTADB
- run "adb devices" to confirm the box is correctly connected.
- go into the AndroidTV Driver, Driver Test, then AddDevice, and customize the command to add the correct IP, Port, etc for the device
At this point i'm pretty much stuck... Even after adding the device as above I dont seem to be able to make it work. I get some errors such as:
1
1/04/2024 20:45:47.45 · DEBUG · AndroidTV.doCommand - Cmd=[7~SendKey~Back] Client=[dashboard-fx-x1vs]
11/04/2024 20:45:47.45 · ERROR · AndroidTV.doCommand - Error in doCommand - Object reference not set to an instance of an object.
11/04/2024 20:45:49.45 · DEBUG · Server.doCommand - AV|{{active_androidtv_{{clientname}}}}~SendKey~Back from dashboard-fx-x1vs
11/04/2024 20:45:49.45 · DEBUG · Server.doCommand - AV|7~SendKey~Back
11/04/2024 20:45:49.45 · DEBUG · AndroidTV.doCommand - Cmd=[7~SendKey~Back] Client=[dashboard-fx-x1vs]
11/04/2024 20:45:49.45 · ERROR · AndroidTV.doCommand - Error in doCommand - Object reference not set to an instance of an object
Apart from this there are several issues which seem to be widespread about Android 11... Namely the Wifi adb doesnt persist after a reboot (or randomly in my experience). Also, every time the unit is rebooted, reconnects to wifi, or has its Wifi ADB put back on, the ADB port updates to another random number...
So this is where I'm stuck... I wonder if others have attacked this issue differently?
One thing that comes to mind is using a IRUsb device from Video-Storm... its pretty cheap and I remember I used it to integrate a Shield with a Control4 project once... I just checked and it seems to allow IP control without the ADB hassles...
www.video-storm.com/manuals/IrUSB_protocol.pdf
is the protocol info... Would this be possible to be supported in myServer to connect to Android devices that are Android 11+?
EDIT: It's slightly more expensive than I remember (around $75) but is an option I'd consider if supported in myServer.
EDIT2: possible solution to get the changing port here:
stackoverflow.com/a/72987868
Android 11 still seems like a pain in the A##