66

While installing the android application in the emulator I am getting the following error.

Please help me to resolve this error.

Error message:

emulator.exe -avd avd_name

adb wait-for-device    

adb install path-to.apk    

could not access the package manager. is the system running while installing android application....
Erfan
  • 163
  • 11
arunkumar.p
  • 1,775
  • 4
  • 18
  • 31
  • i don't understand what the error is. is there a specific error message ? – njzk2 Mar 20 '13 at 13:01
  • could not access the package manager. is the system running??????... – arunkumar.p Mar 20 '13 at 13:02
  • Please refer the above 3 target.while executing the last target(push_tests_to_device) we got the following error. – arunkumar.p Mar 20 '13 at 13:14
  • 1
    "could not access the package manager. is the system running?".The emulator launched successfully,but it took some time to launch. – arunkumar.p Mar 20 '13 at 13:17
  • does `adb devices` lists the device ? if not, does adb connect works ? – njzk2 Mar 20 '13 at 13:24
  • yes, it shows the list of devices attached as emulator-5554 device – arunkumar.p Mar 20 '13 at 13:26
  • from the targets you posted, the "push_tests_to_device" depends on "list_device", but shouldn't it depend on "wait-for-device" instead? Not really sure what other targets you may have, but I think that at some point your "depends" chain should end up in "wait-for-device" for this to work. What happens if ant cannot find a "depends" target? If it then chooses to skip that target, you are actually not waiting at all.. – baske Mar 20 '13 at 13:31
  • Actually that push_tests_to_device depends on list_devices and in-turn the list_devices target depends on wait-for-device.. sorry i didn't post that target due to some space problem..... – arunkumar.p Mar 20 '13 at 13:40

10 Answers10

91

You need to wait for the emulator to full start - takes a few minutes. Once it is fully started (UI on the emulator will change), it should work.

You will need to restart the app after the emulator is running and choose the running emulator when prompted.

Community
  • 1
  • 1
ssaltman
  • 3,623
  • 1
  • 18
  • 21
8

As other have said, this error occurs because the emulator is still in the process of launching. An attempt to access the package manager, for the device, at this time causes an error.

It's just a simple timing issue. Here are the steps to avoid this error:

  1. Wait until the emulator 'lock screen' is showing.
  2. Run the 'app' again (^R in most IDE's).
  3. Choose the running device (Should be the same emulator).

App should install without error.

Saeed Gatson
  • 517
  • 5
  • 18
5

In my case it was just that the emulator took 9 minutes to start. Wait until you see the lock icon on the emulator LCD. Or use actual tablet or phone.

Magier
  • 437
  • 1
  • 6
  • 18
Trevor
  • 51
  • 1
  • 1
4

Facing Same issues following Link helped solving the problem. The above solutions were not helpful for me. deployment-failed-could-not-access-the-package-manager-is-the-system-running

By restarting server using CMD application was back to work. Open cmd (Run as administrator), open this

cd C:\Program Files (x86)\Android\android-sdk\platform-tools

(this path must specify your android-sdk installation folder )

Now, first write, adb kill-server and then adb start-server.

Community
  • 1
  • 1
Divya
  • 1,203
  • 2
  • 13
  • 31
  • 1
    This answer ist outdated, something like adb does not exist in this directory structure (anymore). – Magier May 10 '18 at 11:29
1

Kill the process/server and restart it.! It worked.

Frankenstein
  • 420
  • 1
  • 5
  • 17
1

You can avoid the error by setting default device before launching application. Launch the AVD before starting the app.

Sofia Khwaja
  • 1,909
  • 3
  • 17
  • 20
1

Once you see this error, wait for emulator to show lock screen. And then relaunch the app in your IDE and check the emulator again. It works for me always.

In Android studio, you can relaunch by clicking the green play button or ctrl + r.

IamLearning
  • 165
  • 1
  • 6
1

If this error is gotten when using a rooted device's su prompt and not from emulator, disable SELinux first

setenforce 0

You may need to switch to shell user first for some pm operations

su shell

then re-run your pm command.

Same applies to am commands unavailable from su prompt.

Fortune
  • 162
  • 1
  • 4
0

The solution for me was to restart the IDE. I suspect that a slow emulator was hiding from view, blocking installation on my device.

Berit Larsen
  • 739
  • 1
  • 12
  • 29
0

Check your project build is in Debug mode not Release, I had some problem for debugging always I forget to change Release mode to Debug (Xamarin Users)

Ali Yousefi
  • 2,355
  • 2
  • 32
  • 47