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

7

19

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.

Purnell answered 2/8, 2021 at 5:46 Comment(8)
Please add more info related to the error, such as a screenshot of your Run window from Android Studio.Floorer
More likely that you're trying to update already installed app but as it is system app - adb doesn't have proper privileges and can't close already running process. Quick solution - manually uninstall your app, then install it again. One more thing - if you're developing system app - to be sure that you app behaves as expected - you should install it in system apps directory with proper Linux permissions (644 if I'm not mistaken). Under installation I mean just placing apk to system apps directory, granting permissions and rebooting device.Rambutan
Thank you for answer. It is a system app , only updates can be uninstalled .Purnell
Is the problem solved? Try to create a new device otherwise!Clarineclarinet
Not yet, I found the same issue at issuetracker.google.com/issues/181004316Purnell
Looks like it's about to be patched in the next update for Android Studio: "We have a fix ready for the next patch of Bumble Bee."Styria
Uninstall the app and run again work for me!Insolation
Restart your deviceRudich
M
5

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.
Moonscape answered 8/9, 2023 at 14:46 Comment(0)
G
2

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

Geomancer answered 3/8, 2022 at 17:45 Comment(0)
F
2

In my case, I just restarted the device, then Android Studio could launch the app normally.

Or you could try: gradlew --stop

This will stop all running daemons

Fluoridation answered 2/12, 2023 at 4:20 Comment(0)
T
1
  1. adb kill-server
  2. adb restart-server
Telamon answered 20/5, 2024 at 2:41 Comment(0)
G
0

The following fixed this for me on a physical device:

  1. Connect phone to PC using a USB cable and enable USB debugging.
  2. Run adb shell cmd package list packages to find package name (use | findstr /c:"foo" to filter the output).
  3. Uninstall the app from the phone using adb uninstall adb uninstall com.my.app (replace com.my.app with your actual app name).
  4. Rerun the app from Android Studio using Shift+F10.

Note that in my case I couldn't see the app on the phone's UI. Only adb was able to detect the app.

Glimp answered 20/10, 2023 at 13:13 Comment(0)
R
0

I work with a physical device but simply reconnecting the cable to my phone worked for me. So before you do any uninstalling, might wanna try the easiest solution.

Rexanna answered 27/2, 2024 at 13:14 Comment(0)
L
-1

After 10 wasted minutes I remembered the basic engineering rule: Pull the plug.
In practice: Restarting Android Studio fixed it for me.

Lilybelle answered 9/1, 2024 at 17:25 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.