Android Studio : Couldn't terminate the existing process for xxx

Viewed 4967

enter image description hereThe application is a system application, and it will be started by other applications. When I install the application from android studio 4.2 or Arctic Fox, it fails with "Couldn't terminate the existing process for" error message. When android studio terminate the app, other app listen ServiceDisonnected and will bind service again, so the app will restart. Installing from the commandline by adb install command or Android studio 4.1.3 works well.

1 Answers

It's because you ran in debug mode or attach debugger and that process is not killed perfectly.

Follow the following to resolve this issue.

  1. Press "Attach Debugger to Android Process" button
  2. "Choose Process" dialog will be shown and the application name is listed, press "OK"
  3. Check the "Debug" tab console, when it says "Connected to the target VM, address: 'localhost:60245', transport: 'socket'"
  4. Press the "Debug" Button.
  5. Device will relaunch the app with latest changes
  6. Now stop from red button in the android studio menu bar. And run app again as normal

Enjoy !!

Related