21

I installed android studio and tried to run easy projects.

But I caught strange error message:

Waiting for device.
/usr/local/idea/android-studio/sdk/tools/emulator -avd Nexus-4-18-xhdpi -netspeed full -netdelay none

emulator: emulator window was out of view and was recentered

Device connected: emulator-5554
Device is online: emulator-5554
Target device: Nexus-4-18-xhdpi [emulator-5554]
Uploading file
    local path: /home/nazar/Documents/coursera-android/Examples/HelloAndroid/out/production/HelloAndroid/HelloAndroid.apk
    remote path: /data/local/tmp/course.examples.HelloWorld.HelloWorld
Installing course.examples.HelloWorld.HelloWorld
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/course.examples.HelloWorld.HelloWorld"
Error: Could not access the Package Manager.  Is the system running?

I couldn't figure out why this happen?

I installed sdk version and configured emulator. Any suggestions?

Here is emulator confiuration:

emulator confiuration

Update:

I tried to install Genymotion device and use few virtual devices, but caught:

Waiting for device.
Target device: genymotion-nexus_4___4_4_2___api_19___768x1280-192.168.56.101:5555
Uploading file
    local path: /home/nazar/Documents/coursera-android/Examples/HelloAndroid/out/production/HelloAndroid/HelloAndroid.apk
    remote path: /data/local/tmp/course.examples.HelloWorld.HelloWorld
Installing course.examples.HelloWorld.HelloWorld
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/course.examples.HelloWorld.HelloWorld"
WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
Error: Could not access the Package Manager.  Is the system running?

How to solve this error?

catch23
  • 17,519
  • 42
  • 144
  • 217
  • possible duplicate of http://stackoverflow.com/questions/15524185/could-not-access-the-package-manager-is-the-system-running-while-installing-and – Piyush Agarwal Feb 03 '14 at 12:01
  • @pyus13 I added some details to the question. I guess it is some trouble with installation... – catch23 Feb 03 '14 at 12:04
  • 1
    You can try this : First launch the emulator using AVD manager and let it start completely . Try to install application once you see the home screen and let me know if still you face the same issue ? Also try to install application from command line instead of Studio and check the results . – Piyush Agarwal Feb 03 '14 at 12:06
  • @pyus13 ` Also try to install application from command line instead of Studio` can you explain more? – catch23 Feb 03 '14 at 12:08
  • Go to `Android SDK\platform-tools` open your cmd there and perform `adb install YOUR_APP_PATH` .Let me know your Android Studio version as well . – Piyush Agarwal Feb 03 '14 at 13:14
  • iS you problem resolved ? Let me know if you need any MORE clarification I will put that in answer. – Piyush Agarwal Feb 03 '14 at 17:10
  • @pyus13 what does this mean `YOUR_APP_PAT`? – catch23 Feb 03 '14 at 20:23
  • your application full path like `adb install "D:/myapps/app.apk"` . try to install any app not specific only the app you are building. – Piyush Agarwal Feb 03 '14 at 20:35
  • check my answer to install apk using command line. – Piyush Agarwal Feb 03 '14 at 20:44
  • 1
    @pyus13 I don't think the other Stackoverflow question you linked to is related to this issue. At least the error message is vastly different. – IgorGanapolsky Feb 12 '14 at 22:15
  • For me, the issue was that Genymotion had frozen. When I restarted it, install then worked. – E L Aug 31 '17 at 16:50

9 Answers9

13

First make sure you are running Android Studio version above 0.3.2 because there was some issue reported regarding the same in AS 0.3.2 . If it is not you can update it from Help >Check for update.

If you are already running AS above 0.3.2 :

Seems like issue is with your emulator not with Android Studio. It may happen that you are trying to install application before even the emulator started properly.

Wait till the home screen appears in the emulator before trying to install any application.

Also try to install any apk in Emulator from command line

Steps to install

  • Go to $Android_SDK_DIR\platform-tools, right click there keeping shift key pressed and Chose "Open Command Window here".
  • Run command adb devices to make sure yout emulator is running properly. It will show all your running emulators.
  • Now if emulators are showing properly, type the command adb install YOUR_FULL_APK_PATH , YOUR_FULL_APK_PATH is of any .apk file path in your system.

Please update if this works fine.

Piyush Agarwal
  • 25,608
  • 8
  • 98
  • 111
  • here is my prompts: `nazar@nazar-desktop:/usr/local/eclipse/android-sdk/adt-bundle-linux-x86_64/sdk/platform-tools$ adb devices List of devices attached ` And empty line... – catch23 Feb 03 '14 at 22:51
  • Run this before adb devices `adb kill-server` than `adb start-server` . – Piyush Agarwal Feb 04 '14 at 03:07
  • Are this ok, that none device is running at this time? – catch23 Feb 04 '14 at 07:52
  • no, if any emulator is running on your machine it should show the emulators list. – Piyush Agarwal Feb 04 '14 at 09:03
  • ya its correct now try to install any app using the command shared and let me know its working or not ? – Piyush Agarwal Feb 04 '14 at 10:50
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/46739/discussion-between-pyus13-and-nazar-art) – Piyush Agarwal Feb 04 '14 at 11:24
  • Just running adb devices will show the device as "online" way before package manager can actually be accessed. I can shell into the device as soon as it is listed as "online". Is there a way to check if package manager is running through the shell? – MikeSchem Jan 24 '17 at 17:15
8

The most common cause of this error is simple: You have to manually unlock your Android Virtual Device by swiping the “lock” icon on the screen. Security measures prevent the emulator from letting you connect the debugger before doing this.

The problem is resolved:

In Android Studio

  1. Start run/debug
  2. if you see the message
  3. Do not closed the AVD, just click on run/debug again, the Application will be running when you unlock the application.
David
  • 208,112
  • 36
  • 198
  • 279
Abhishek2k6
  • 425
  • 5
  • 9
5

The same problem but different solution, I modified my Virtual Device, I changed Memory option and Internal Storage, and it works fine. RAM:512 , VM HEap: 192, Internal Storage=200, SD Card Size: 200 for Device Nexus 4 android 4.2.2.

Juan Tomaylla
  • 51
  • 1
  • 1
4

In my case this error was caused by SELinux. I got to set SELinux to permissive.

adb shell su 0 setenforce 0
yuliskov
  • 1,379
  • 15
  • 16
2

I had this issue, but I found that simply killing the emulator and restarting it worked. There seems to be some sort of race condition where the emulator has not initialized before Android Studio tries to launch the apk and so you get the package error.

Bob A
  • 21
  • 1
1

I had this too, and using this config worked for me :

Device: Nexus One
Target: Android 4.2.2 -api level 17
CPU/ABI: ARM (armeabi-v7a)
Keyboard: Hardware keyboard present

Memory Options:

RAM: 512
VM Heap: 192
Iternal Storage: 200

SD Card:

Size:200

catch23
  • 17,519
  • 42
  • 144
  • 217
TheMah
  • 378
  • 5
  • 19
1

This Is Worked for me

1)Close Solution.

2)Close Emulator.

3)Run Emulator and Wait till it launch completely and shows Home Screen.

4)After that only Open Solution And Clean,Rebuild and Try to deploy Application.

Neelam Prajapati
  • 3,764
  • 3
  • 28
  • 62
0

The same happened to me right now. I don't know if there is another but for me the following worked:

  • Opened AVD (Android Virtual Device) Manager
  • Started virtual device
  • Hit the Run button again (that one at status bar)

Explanation: The problem happened because of timeout. Once device had started, the Android Studio could comunicate with him. (v 0.5.3)

0
  1. Remove this emulator (in the AVD)
  2. Install this emulator (in the AVD) :)
user_MGU
  • 978
  • 11
  • 11