Android
1. Introduction to ADB
ADB (Android Debug Bridge) is a command-line tool that allows users to interact with Android devices or emulators. It serves as a crucial debugging tool in Android development, enabling developers to perform operations such as device management, app installation, log viewing, and file transfer. ADB operates on a client-server architecture for communication between a development machine and an Android device.
2. Hardware Connection
Connect the development board to the computer using a Type-C data cable (Note: This USB port is not a power port).
3. ADB Installation (Windows)
- Download the ADB installation package, extract it, and use it directly (click here to download).
- Right-click This PC and select Properties -> Advanced system settings -> Environment Variables.

- In System variables, edit
Pathand add the extracted ADB directory.

- Click OK to save the environment variables.

4. ADB Installation (Ubuntu)
- Install the ADB tool.
sudo apt-get install android-tools-adb -y
- If the correct udev rules are not configured, regular users cannot access USB devices. When running
adb shell, errors such as “udev rules wrong” or insufficient permissions may appear.

- Use
lsusbto check the device ID.

- Create or edit the udev rules file:
sudo vim /etc/udev/rules.d/51-android.rules
- Add the following content to grant read/write permissions to users in the
plugdevgroup for devices with ID2207:0019:
SUBSYSTEM=="usb", ATTR{idVendor}=="2207", ATTR{idProduct}=="0019", MODE="0666", GROUP="plugdev"
- After saving the file, change its permission:
sudo chmod 644 /etc/udev/rules.d/51-android.rules
- Reload the udev rules:
sudo udevadm control --reload-rules
sudo service udev restart
- Reconnect the device by unplugging and plugging it back in to ensure the new rules take effect.

5. ADB Debugging
- Press Win + R, enter
CMD, and open the Windows terminal. Run an ADB command to confirm that ADB is available.

- If only one device is connected, run the following command in PowerShell or CMD:
adb shell
- If multiple devices are connected, view the list of currently connected ADB devices:
adb devices
Example:
C:\Users\cjw> adb devices
List of devices attached
103ea97dececc831 device
d48936ed7d1551fc device
- After confirming the target device, log in to the board by specifying the device serial number:
adb -s d48936ed7d1551fc shell
After plugging or unplugging the board, run adb devices again to confirm whether the target device has been recognized. If it is not recognized, try replacing the Type-C data cable and check whether the connector has poor contact.
6. ADB App Installation and Uninstallation
6.1 Installation
-
Basic syntax:
adb install [options] <apk_file_path>adb: ADB command prefix.install: Install an APK file.<apk_file_path>: Path to the APK file (use full path or filename if in the current directory).
-
Common options:
-r: Reinstall an existing app while preserving user data.-d: Allow downgrading to an older app version.-s: Install the app to the SD card instead of internal storage.-g: Grant all runtime permissions during installation.-t: Allow installation of test-signed apps.
-
Example:
PS D:\Download\NFCTag_CN> adb install test.apk3200 KB/s (17677887 bytes in 5.393s)Success
6.2 Uninstallation
-
Basic syntax:
adb uninstall <package_name>adb: ADB command tool.uninstall: Remove an app.<package_name>: App package name (e.g.,luckfox).
-
Example:
adb uninstall luckfoxFailure [DELETE_FAILED_INTERNAL_ERROR]: Verify the package name usingadb shell pm list packages.Failure [DELETE_FAILED_DEVICE_POLICY_MANAGER]: Disable device admin privileges in Settings → Security → Device administrators before uninstalling.