无法通过 Android Studio 启动应用程序 (logcat [DEAD]) [英] Can't launch application through Android Studio (logcat [DEAD])

查看:91
本文介绍了无法通过 Android Studio 启动应用程序 (logcat [DEAD])的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近两天,我正在开发的应用程序在 logcat 中显示为 [DEAD],当我尝试通过 Android Studio 中的运行按钮启动应用程序时,一切似乎都很好,只是应用程序从不启动并离开Android Studio 中没有错误消息,除了 [DEAD].知道这是什么吗?

For the last two days the app I'm working on is showing up as [DEAD] in logcat and when I try to launch the app through the run button in Android Studio all seems fine, except the app never start and leaves no error message in Android Studio, except for [DEAD]. Any idea what this is?

更新:我已经能够通过以下方式从 logcat 中删除 [DEAD] 内容:

Update: I have been able to remove the [DEAD] thing from the logcat by:

  • 从设备中删除应用
  • 重新启动设备(不应该是这样,因为它在发生之前才启动,但以防万一)
  • 使缓存无效并在 Android Studio 中重新启动
  • 从 Android Studio 的工具栏中重新运行应用

这可能有助于让你重新开始,但我的问题仍然存在.

This might help to get you going again, but my question stays.

这是什么?

为什么会这样?

解决问题的正确方法是什么?

And whats the correct way of solving it?

推荐答案

出现上述错误是由于

java.io.IOException

java.io.IOException

这会导致当前 adb-connection 断开连接并连接到另一个软件发出的新 adb-connection 请求.

which causes the current adb-connection to disconnect and connect to the new adb-connection request made by another software .

java.io.IOException: An established connection was aborted by the software in your host machine

当你启动一个 adb 客户端时,客户端首先会检查是否有一个 adb 服务器进程已经在运行.如果没有,它将启动服务器进程.当服务器启动时,它绑定到本地 TCP 端口 5037 并侦听从 adb 客户端发送的命令——所有 adb 客户端都使用端口 5037 与 adb 服务器通信.

When you start an adb client, the client first checks whether there is an adb server process already running. If there isn't, it starts the server process. When the server starts, it binds to local TCP port 5037 and listens for commands sent from adb clients—all adb clients use port 5037 to communicate with the adb server.

服务器然后建立与所有正在运行的模拟器/设备实例的连接.它通过扫描 5555 到 5585(模拟器/设备使用的范围)范围内的奇数端口来定位模拟器/设备实例.在服务器找到 adb 守护进程的地方,它会建立到该端口的连接.请注意,每个仿真器/设备实例都会获取一对顺序端口——一个用于控制台连接的偶数端口和一个用于 adb 连接的奇数端口.

The server then sets up connections to all running emulator/device instances. It locates emulator/device instances by scanning odd-numbered ports in the range 5555 to 5585, the range used by emulators/devices. Where the server finds an adb daemon, it sets up a connection to that port. Note that each emulator/device instance acquires a pair of sequential ports — an even-numbered port for console connections and an odd-numbered port for adb connections.

以上信息也可以从其文档中看到http://developer.android.com/tools/help/adb.html

Above information can also be seen from its documentation http://developer.android.com/tools/help/adb.html

当一个新应用程序使用相同的连接时,您的 Android Studio 应用程序在 logcat 中报告 DEAD.要解决此问题,请使用 adb kill-server 命令

When a new application uses the same connection,your Android studio app reports DEAD in logcat. To resolve the issue,use the adb kill-server command

adb kill-server  //Terminates the adb server process.

然后重新运行您的应用程序.

and then rerun your application.

这篇关于无法通过 Android Studio 启动应用程序 (logcat [DEAD])的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆