Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 707
Zero Avatar asked Nov 17 '25 02:11

Zero


2 Answers

I have Android Studio Electric Eel | 2022.1.1 Patch 1. The only 2 temporary solutions that have worked for me are:

  1. Uninstall the application and then invalidate the project cache (File/Invalidate caches).
  2. (Only for physical devices) Uninstall the application and then disconnect the USB cable, you must make sure that Android detects this connection and disconnection.
like image 52
JAIME RAFAEL DE C Avatar answered Nov 19 '25 16:11

JAIME RAFAEL DE C


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 !!

like image 38
Sajid Zeb Avatar answered Nov 19 '25 17:11

Sajid Zeb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!