How to solve intellij idea android adb connection not available exception
When we test android application in IntelliJ idea , sometimes we got adb connection not available exception ,and this is an example to show how to solve it.
1. The exception
When we start the app, the emulator started, and then we got this:
1) What is adb
?
ADB (Android Debug Bridge) is a command-line tool that allows developers and testers to communicate with an Android device connected to a computer.
ADB can be used for a variety of purposes, including:
- Install and debug apps: With ADB, developers can install apps on devices without the Google Play Store, and can debug apps to find and fix problems.
- Access the device file system: ADB allows users to browse and modify files on the device, which is very useful for testing and development.
- Run Shell commands: Through ADB, you can remotely execute Shell commands on the Android device.
- Port forwarding: ADB can create port forwardings, allowing developers to access specific ports on the device.
- Logging: Log output from a device can be captured and viewed, which is useful for debugging.
- Device management: ADB can also be used for device management tasks, such as restarting a device.
To use ADB, you usually need to install the Android SDK (Software Development Kit) on your computer, then connect your Android device to the computer via USB, and make sure the device has USB debugging mode turned on. After that, you can use adb commands in the command line to perform various operations.
2. The solution
You can just do as follows:
- terminate IntelliJ idea and the android emulator
- check the process manager , make sure there is not any java application running
- restart the IntelliJ IDEA,and run the android application to start the emulator
- when the emulator started, click the android monitor to view the logs messages of the emulator
- If your app is still not running in the emulator, just rerun the app
You can find detail documents about the android adb here: