Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't launch application through Android Studio (logcat [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?

enter image description here

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

  • Removing the app from the device
  • Restarting the device (Should not have been this because it was just started befor it happened, but just in case)
  • Invalidate caches and restart in Android Studio
  • Re-run the app from the toolbar in Android Studio

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

What is this?

Why does it happen?

And whats the correct way of solving it?

like image 361
just_user Avatar asked Aug 04 '15 07:08

just_user


People also ask

Why my Logcat are not working Android Studio?

Solution 1: Restarting your Android StudioIn your IDE Go to File > Invalidate Caches and Restart > Invalidate and Restart. This Solution will clear all the caches of Android studio IDE and restart it automatically, By the method, there are 80% change that Logcat will start work as before.

How do you select your application when using Android Studio Logcat window?

View your app logs To display the log messages for an app: Build and run your app on a device. Click View > Tool Windows > Logcat (or click Logcat in the tool window bar).

Why is my Logcat empty Android Studio?

Go to the File option > click on “INVALIDATE CACHES/RESTART” then a dialog box will pop up, Select the “INVALIDATE CACHES/RESTART” button. This will automatically restart and build the index of android studio.

What is Logcat application?

Logcat is a command-line tool that dumps a log of system messages, including stack traces when the device throws an error and messages that you have written from your app with the Log class. This page is about the command-line logcat tool, but you can also view log messages from the Logcat window in Android Studio.


1 Answers

The above error is due to

java.io.IOException

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

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.

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.

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

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.

like image 152
kapilgm Avatar answered Sep 23 '22 17:09

kapilgm