Problem
When trying to use the Android Development Bridge command line tool (adb
tool) to list or connect to Android devices from a cluster, you receive an error.
Error - “FileNotFoundError: [Errno 2] No such file or directory: 'adb'”
You notice the adb
tool works in your local system.
Cause
The adb
tool is not installed in the correct system path, causing commands to go unrecognized on the cluster.
The adb
tool comes pre-packaged with Android Studio and Android Platform Tools Bundle, which is why it works in your local system.
Solution
Use the following example init script to install the adb
tool in the cluster and set in the correct system path. Because the Databricks Runtime images are Ubuntu-based, the init script uses the Linux download for the adb
tool.
#!/bin/bash
# Download the latest platform-tools for Linux
wget -qO /tmp/platform-tools.zip https://dl.google.com/android/repository/platform-tools-latest-linux.zip
# Unzip the downloaded file to a temporary directory
unzip -q /tmp/platform-tools.zip -d /tmp/
sudo cp /tmp/platform-tools/adb /usr/local/bin/adb
# Clean up temporary files and directories
rm -rf /tmp/platform-tools.zip /tmp/platform-tools
# Optional: Verify the installation by printing adb version
adb version
For more information, refer to the Android SDK Platform Tools release notes documentation.