Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is "adb install (my APK)" triggering "can't find service: package"?

I am starting up an android virtual device, but I am getting:

Starting emulator for AVD 'avd.1' pulseaudio: pa_context_connect() failed pulseaudio: Reason: Connection refused pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver emulator: Listening for console connections on port: 5558 emulator: Serial number of this emulator (for ADB): emulator-5558 

The emulator is coming up but I see no icons on it so I'm wondering if the errors listed above are "showstoppers"? Then when I try adb install bin/my.apk I get the error Can't find service: package. So it seems adb is not communicating with the AVD correctly. However, adb devices does show emulator-5558 listed above. Any advice would be really helpful.

like image 299
user3063547 Avatar asked Mar 17 '17 23:03

user3063547


People also ask

What is ADB APK?

Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device.


1 Answers

You have essentially answered your own question while asking it. The root of the problem is that the emulator is not setup properly (evidenced by the system UI not loading). When Android can't boot properly, it is likely to fail to start some system services (in this case, the package service).

The solution is to recreate the emulator, possibly with a different system image (in case the one you have been using is corrupt). If you are using an official image, try switching API levels, or switch from a GMS-enabled emulator image to a non-GMS image (or vice-versa).

like image 60
BLuFeNiX Avatar answered Oct 10 '22 00:10

BLuFeNiX