Problems related to adb, such as dropped calls, Android Studio prompts Session 'app': Error Installing APK, device not found

In the development process, whether we use Eclipse or Android Studio, there will be adb disconnection and adb inability to connect. Especially when using Eclipse, the disconnection problem is particularly serious. This hindered our debugging to a great extent.

 

For example, the following question: When I use Android Studio, I use the real machine to debug, the operation is unsuccessful, and the error in the picture below is prompted (Session 'app': Error Installing APK).


 

Generally speaking, there are several ways to solve this problem:

1. Recompile

2. Replug the data cable

3. Change the Studio settings and uncheck the first checkbox below


4. Restart adb (described later in the method)

5. Solve the problem that the adb port is occupied (the method will be said later)

I solved the problem with the 5th method, everyone's situation will be different

 

The reason why the device cannot be found may also be caused by the adb disconnection problem. Another reason is that the usb debugging in the developer options of the mobile phone is not turned on.

 

The next step is to solve the problem of adb disconnection:

1. Restart adb

Enter adb kill-server at the command line

then enter adb devices

2. Restart adb.exe

Task Manager closes the adb.exe process

Then enter  adb devices on the command line 

3. Check if port 5037 is occupied

Command line input netstat -aon|findstr 5037 to view the process using port 5037

Suppose you see that 3213 is using port 5037    

   输入 tasklist | findstr "3213"  查看这个进程是哪个程序创建的,如果不是adb,通过以下命令杀死它

 taskkill /f /pid 3212

最后重新插拔数据线,输入adb devices试试

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326078006&siteId=291194637