I was trying to run my application on my Android device using Android Studio, it runs fine otherwise but in this case some data was being deleted from my mobile phone and while that process wasn't done yet, Android studio was trying to install and run the app which caused my phone to get stuck for a while and restart.
So I would like to know if there is a way to get the full stack trace of the error and does this mean that my application is probably not properly structured and got killed in the middle of an important process?
Thank you.
This is the error I got at that time:
Installation failed with message Failed to finalize session : Unknown failure (cmd:Failure calling service package: Broken pipe (32)).
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
PS : I'm not asking about how to solve this error because my app runs, I want to understand what might have caused it.
Just for some clarification :
What exactly the Broken Pipe error means ?
It means that when a process requests an output to pipe or socket, which was closed by peer.
So, according to error here in Android Studio is that Gradle Deamon was trying to execute an adb command to install (push) latest generate .apk
file (writing application package through socket using tcpip protocol) but connection gets lost by adb to device so that Gradle failed to execute command.
Sometimes, loose/poor connection to device causes this kind of issue.
(In some of the cases, updated incremental dex
doesn't gets written to device, and .apk
becomes corrupted due to outdated dex
& so that it warns to reinstall apk by removing old one.)
Now, if you failed to grab logcat from Android Studio 'Logcat' window then you can still get bug report/logcat using this command in terminal
adb bugreport 'path to store bug report(optional)'
or use
adb logcat
to see log of device
For grabbing detailed or filtered log: link
That has nothing to do with your query: (does this mean that my application is probably not properly structured and got killed in the middle of an important process?)
So, everything will be perfectly fine once you re-run (reinstall) your .apk