Unknown failure (cmd:Failure calling service package: Broken pipe (32))
Asked Answered
C

5

9

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.

Cornish answered 4/9, 2018 at 13:20 Comment(6)
Build-> clean projectRalph
My app runs, I just want to understand the reason behind the error message.Cornish
which caused my phone to get stuck for a while and restart., does your app access system/root files?Ellswerth
@GiovanniTerlingen no it doesn'tCornish
have you check gradle version is latest?Petrarch
@ViralPatel Yes, it's the latestCornish
A
3

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

Aeroscope answered 13/9, 2018 at 20:9 Comment(0)
E
1

does this mean that my application is probably not properly structured and got killed in the middle of an important process?

Well, I think there is not much to worry since you mention that your app is running fine. I think we should not search the problem in your app. Since it runs fine, it should be coded fine as well.

Android studio was trying to install and run the app

There we go! This is purely speculation, but I think Android Studio was the problem. When you are developing an app, every time you make changes, Android Studio will restart the app. Which is the so called instant run: https://developer.android.com/studio/run/#ir-limitations

I developed lots of native apps and I never enjoyed instant run. In rare cases, it malformed my application. UI didn't reload properly and got several issues. So whenever I develop mobile applications now, I just disable instant run.

I am mentioning instant run, since it might have broken your application while it was busy doing some I/O operations. This is not bad from your side, but I would recommend you to test and develop without using instant run for a while. Without instant run, you are guaranteed to install a full compiled application in your phone. This will or should also prevent you this issue in the future.

Ellswerth answered 7/9, 2018 at 12:56 Comment(0)
T
1

I had the same problem. This solution worked for me :

  1. Upgrading plugins & Flutter SDK
  2. Cleaned and re-build the project
  3. Cold Booting the emulator

The app properly runs now and that error is gone . Answering in case it might help someone else .

Toluate answered 16/8, 2022 at 6:23 Comment(0)
P
0

All \ on your paths should be replaced by /.

Pamphleteer answered 24/11, 2022 at 9:57 Comment(0)
L
0

In my case it was failure on the Emulator device so the solution for me was to 1-Restart the device you are running on 2-try to run again PS : maybe you should clean and rebuild the project

Lakitalaks answered 14/8, 2023 at 7:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.