'How do I fix "Could not connect to remote process" while trying to debug the application?

I am making a android studio project and I try to debug my application.

Running the application works fine, but when I try to debug it I get this error:

Could not connect to remote process. Aborting debug session.

What can I do to fix the issue?



Solution 1:[1]

You need to restart the ADB.

kill adb.exe process.

how to restart ADB manually from Android Studio

Solution 2:[2]

Sometimes this happens when two Android-capable IDEs are opened, e.g. Android Studio and IDEA. Shutdown one of the two (or disable Android plugin in IDEA) helps.

Solution 3:[3]

In My case, For some reason I disabled Instant run and it has changed the Launch value from "Default Activity" to "Nothing" in "Run/Debug configurations". So always it says "Could not connect to remote process. Aborting debug session" and I was not able to debug. I enabled Instant and changed the Launch value from "Nothing" to "Default Activity" in "Run/Debug configurations" and it worked. Hope this will help some one.

(to get Run/Debug configurations, click "app" drop down and click Edit Configurations)

Solution 4:[4]

Check if you have selected the right Build Variant, usually "release" comes with debuggable false

Example:

 buildTypes {
        release {
            debuggable false
            ....
        }
    }

is not recommendable change release to debuggable true, just change the right variant

   debug {
        debuggable true
        ....
    }

Solution 5:[5]

I try invalidate cache / restart and it's work

Solution 6:[6]

+1 to Kuzne?'s answer.

When Intellij and Android Studio are both open, apparently the Android plugin in Intellij needs to be disabled. This wasn't always the case but it resolve the issue for me.

  • Mac OSX 12.2.1
  • IntelliJ 2021.3.1
  • Android Studio 2021.1.1 Patch 2

Solution 7:[7]

In command line :

adb kill-server && adb start-server

This command will restart ADB

Solution 8:[8]

Verify on AndroidManifest that your LAUNCHER activity has:

android:exported="true"

Solution 9:[9]

By default Android Studio builds the debug version of the application. However, during the publishing phase you may have switched to the release one as the tutorial suggests.

ADB won't be able to attach to the application unless you revert to the debug configuration or you allow to the debug the release one.

If nothing of this works, you may resort in restarting ADB as explianed in How to restart ADB manually from Android Studio

Revert to debug configuration

  1. Choose Build->Select Build Variant
  2. Pick up debug in the second column
  3. Deploy the application again

Allow the release version to be debugged

  1. Select your application node in the tree
  2. Right click and choose Open Module Settings (or hit F4)
  3. Select Build Variants on the left
  4. Choose release on the right
  5. Set debuggable to true
  6. Apply and deploy the application

Keep in mind that your life won't be easy as your application may be optimized and therefore not debugger friendly (e.g. you might not be able to step in certain methods, or view some local variables).

Solution 10:[10]

Restarted the ABD server. First the device had to be connected. Look for the "Assistant" tab in android studio (on the right side it usually is), and press next until you see the option to reset the ABD server.

Solution 11:[11]

I did

--->adb kill-server && adb start-server

--->invalidate cache / restart

but not work yet

Waiting for application to come online: com.example.distribution_system | com.example.distribution_system.test

Waiting for application to come online: com.example.distribution_system | com.example.distribution_system.test
    
Waiting for application to come online: com.example.distribution_system | com.example.distribution_system.test
    
Could not connect to remote process. Aborting debug session.

image1:--> [1]: https://i.stack.imgur.com/HZF5D.png

image2:--> [2]: https://i.stack.imgur.com/hrE4a.png

Solution 12:[12]

I got this error message when the phone was connected both via wi-fi (using "adb tcpip 5555" and "adb connect 192.168.0.100:5555" commands) and via a usb cable. Disconnecting the USB cable resolved the issue.

Solution 13:[13]

The other solutions posted here did not help me. I eventually discovered that creating a new simulator instance (tools->AVD Manager->Create virtual device) solved my problem. I was unable to get the previous simulator working again.

Solution 14:[14]

I followed all the recommendations above, but the problem was solved only after I used the Generate Signed Bundle and selected the desired flavor