尝试调试时如何解决:无法连接到远程进程。中止调试会话,

SAP*_*PHI 6 java debugging android android-studio

我正在制作一个android studio项目,并尝试调试我的应用程序。运行应用程序工作正常。但是,当我尝试调试时,出现错误:无法连接到远程进程。中止调试会话。

Kuz*_*neц 19

有时,当打开两个支持 Android 的 IDE(例如 Android Studio 和 IDEA)时,会发生这种情况。关闭两者之一(或在 IDEA 中禁用 Android 插件)会有所帮助。


小智 7

在我的情况下,出于某种原因,我禁用了即时运行,它已将“运行/调试配置”中的“启动”值从“默认活动”更改为“无”。所以总是说“无法连接到远程进程。中止调试会话”,我无法调试。我启用了 Instant 并在“运行/调试配置”中将 Launch 值从“Nothing”更改为“Default Activity”并且它起作用了。希望这会帮助某人。

(要获取运行/调试配置,请单击“应用程序”下拉菜单,然后单击“编辑配置”)


Dan*_* B. 6

您需要重新启动ADB。

杀死adb.exe进程。

如何从Android Studio手动重新启动ADB

  • 每次手动杀死 adb.exe 都对我有用。当我收到此错误时,从工作室手动重启不起作用。 (2认同)

Bho*_*ala 6

在 AndroidManifest 上验证您的 LAUNCHER 活动是否具有:

android:exported="true"
Run Code Online (Sandbox Code Playgroud)


Azh*_*ott 5

检查您是否选择了正确的 Build Variant,通常“ release ”附带debuggable false

例子:

 buildTypes {
        release {
            debuggable false
            ....
        }
    }
Run Code Online (Sandbox Code Playgroud)

不建议将发布更改为debuggable true,只需更改正确的变体

   debug {
        debuggable true
        ....
    }
Run Code Online (Sandbox Code Playgroud)


Van*_*hel 5

我尝试使缓存无效/重新启动,它起作用了