SAPHI
SAPHI

Reputation: 495

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?

Upvotes: 48

Views: 42954

Answers (17)

crifan
crifan

Reputation: 14328

  • My case
    • use Android Studio create a simple android app but no activity
      • current settings: Android Studio->Run->Edit Configuration->General->Launch Options->Launch: Nothing
        • for later used as Xposed plugin, which is no need UI=activity
  • Error
    • first Timed out waiting for process to appear on
    • final error: Processes are not found Aborting session
  • Reason
    • for Android app, activity ~= process
      • no activity mean can not debug
  • Solution
    • for me
      • done nothing
        • for no activity android app: can NOT debug
          • activity == UI page ~= proecess, so no activity means no process, cause can not debug
    • for others (normal android with activity)
      • change Launch to Default Activity

Upvotes: 0

Mohamed Mohamed Taha
Mohamed Mohamed Taha

Reputation: 172

All solution didn't fix my issue, If you face it same me try that solution enter link description here

Upvotes: 0

Nigel N.
Nigel N.

Reputation: 337

For me the problem was a wrong launch flag set in the Run/Debug Configurations. I found out about this by taking the adb command that is executed to launch the app, which can be found in the "Run" tab. The command looks like this:

adb shell am start -n "com.your.package...." -a android.intent.action.MAIN -c android.intent.category.LAUNCHER

By executing the command manually in the terminal, i got an error message which pointed me to the problem.

Upvotes: 0

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

Upvotes: 0

D Smith
D Smith

Reputation: 31

+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

Upvotes: 3

Bhola Bhala
Bhola Bhala

Reputation: 199

Verify on AndroidManifest that your LAUNCHER activity has:

android:exported="true"

Upvotes: 7

Mohsen_AB
Mohsen_AB

Reputation: 39

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.sstatic.net/HZF5D.png

image2:--> [2]: https://i.sstatic.net/hrE4a.png

Upvotes: 1

Claudio
Claudio

Reputation: 84

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.

Upvotes: 1

Kuzneц
Kuzneц

Reputation: 727

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.

Upvotes: 19

Vanya Rachel
Vanya Rachel

Reputation: 1403

I try invalidate cache / restart and it's work

Upvotes: 5

dacoinminster
dacoinminster

Reputation: 3687

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.

Upvotes: 0

Sergey
Sergey

Reputation: 1050

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.

Upvotes: 0

Yennefer
Yennefer

Reputation: 6234

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).

Upvotes: 2

Kevin ABRIOUX
Kevin ABRIOUX

Reputation: 17705

In command line :

adb kill-server && adb start-server

This command will restart ADB

Upvotes: 4

Azhagthott
Azhagthott

Reputation: 502

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
        ....
    }

Upvotes: 7

nuwancy
nuwancy

Reputation: 391

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)

Upvotes: 17

Daniel B.
Daniel B.

Reputation: 2601

You need to restart the ADB.

kill adb.exe process.

how to restart ADB manually from Android Studio

Upvotes: 41

Related Questions