2

Suddenly, in the middle of the day, I cannot run apps on my Samsung Galaxy Nexus running stock Android 4.3 from Android Studio (not even ones created from scratch)

adb:

11-11 15:26:12.213 5344-5344/? E/AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: main
11-11 15:26:12.213 5344-5344/? E/AndroidRuntime: java.lang.SecurityException: Neither user 2000 nor current process has android.permission.INSTALL_PACKAGES.
11-11 15:26:12.213 5344-5344/? E/AndroidRuntime:     at android.os.Parcel.readException(Parcel.java:1431)
11-11 15:26:12.213 5344-5344/? E/AndroidRuntime:     at android.os.Parcel.readException(Parcel.java:1385)
11-11 15:26:12.213 5344-5344/? E/AndroidRuntime:     at android.content.pm.IPackageManager$Stub$Proxy.installPackageWithVerificationAndEncryption(IPackageManager.java:3253)
11-11 15:26:12.213 5344-5344/? E/AndroidRuntime:     at com.android.commands.pm.Pm.runInstall(Pm.java:931)
11-11 15:26:12.213 5344-5344/? E/AndroidRuntime:     at com.android.commands.pm.Pm.run(Pm.java:109)
11-11 15:26:12.213 5344-5344/? E/AndroidRuntime:     at com.android.commands.pm.Pm.main(Pm.java:77)
11-11 15:26:12.213 5344-5344/? E/AndroidRuntime:     at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
11-11 15:26:12.213 5344-5344/? E/AndroidRuntime:     at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:235)
11-11 15:26:12.213 5344-5344/? E/AndroidRuntime:     at dalvik.system.NativeStart.main(Native Method)
11-11 15:26:12.221 5344-5344/? E/JavaBinder: Unknown binder error code. 0xfffffff7
11-11 15:26:12.221 5344-5344/? E/ServiceManager: error in getService
11-11 15:26:12.221 5344-5344/? E/ServiceManager: android.os.RemoteException: Unknown binder error code. 0xfffffff7
11-11 15:26:12.221 5344-5344/? E/ServiceManager:     at android.os.BinderProxy.transact(Native Method)
11-11 15:26:12.221 5344-5344/? E/ServiceManager:     at android.os.ServiceManagerProxy.getService(ServiceManagerNative.java:123)
11-11 15:26:12.221 5344-5344/? E/ServiceManager:     at android.os.ServiceManager.getService(ServiceManager.java:55)
11-11 15:26:12.221 5344-5344/? E/ServiceManager:     at android.app.ActivityManagerNative$1.create(ActivityManagerNative.java:1893)
11-11 15:26:12.221 5344-5344/? E/ServiceManager:     at android.app.ActivityManagerNative$1.create(ActivityManagerNative.java:1891)
11-11 15:26:12.221 5344-5344/? E/ServiceManager:     at android.util.Singleton.get(Singleton.java:34)
11-11 15:26:12.221 5344-5344/? E/ServiceManager:     at android.app.ActivityManagerNative.getDefault(ActivityManagerNative.java:73)
11-11 15:26:12.221 5344-5344/? E/ServiceManager:     at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:76)
11-11 15:26:12.221 5344-5344/? E/ServiceManager:     at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
11-11 15:26:12.221 5344-5344/? E/ServiceManager:     at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
11-11 15:26:12.221 5344-5344/? E/ServiceManager:     at dalvik.system.NativeStart.main(Native Method)
11-11 15:26:12.221 5344-5344/? I/Process: Sending signal. PID: 5344 SIG: 9
11-11 15:26:12.221 5344-5344/? E/AndroidRuntime: Error reporting crash
11-11 15:26:12.221 5344-5344/? E/AndroidRuntime: java.lang.NullPointerException
11-11 15:26:12.221 5344-5344/? E/AndroidRuntime:     at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:76)
11-11 15:26:12.221 5344-5344/? E/AndroidRuntime:     at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
11-11 15:26:12.221 5344-5344/? E/AndroidRuntime:     at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
11-11 15:26:12.221 5344-5344/? E/AndroidRuntime:     at dalvik.system.NativeStart.main(Native Method)

Also in the run panel:

Uploading file
    local path: /Users/zsszatmari/projects/app-

android/app/build/outputs/apk/app-debug.apk
    remote path: /data/local/tmp/com.app
Installing com.app
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.app"
    pkg: /data/local/tmp/com.app
Killed 


Launching application: com.app/com.app.ui.LoginActivity.
DEVICE SHELL COMMAND: am start  -n "com.app/com.app.ui.LoginActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.app/.ui.LoginActivity }
java.lang.SecurityException: Permission Denial: startActivity asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
    at android.os.Parcel.readException(Parcel.java:1431)
    at android.os.Parcel.readException(Parcel.java:1385)
    at android.app.ActivityManagerProxy.startActivityAsUser(ActivityManagerNative.java:1984)
    at com.android.commands.am.Am.runStart(Am.java:617)
    at com.android.commands.am.Am.onRun(Am.java:232)
    at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
    at com.android.commands.am.Am.main(Am.java:75)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:235)
    at dalvik.system.NativeStart.main(Native Method)

`

It works on emulator. I tried wiping the device (twice), restarting developer machine, replacing usb cable. Otherwise the phone works well. I can install apps from the Market. Do you have any idea how to make it work?

Any Ideas?

EDIT:

Also, if I do adb install app-debug.apk, it does:

3876 KB/s (1883040 bytes in 0.474s)pkg: /data/local/tmp/app-debug.apk
Killed

Why would it be killed? By whom? Not a very helpful message.

Also tried running Android Studio with an another desktop OS, same effect.

Zsolt Szatmari
  • 1,219
  • 1
  • 12
  • 29
  • 1
    Just making a guess here, if you upload your apk to dropbox or such, and try to install it from URL, does it allow you to do it ? – prashant Nov 11 '15 at 15:17
  • Thanks for trying to help! Yes, I can successfully app when downloading from the web. Obviously, not a very solid workflow :) – Zsolt Szatmari Nov 11 '15 at 15:34
  • Ok, so only installing via adb is causing the problem. I'm not an expert on adb side. May be something mentioned here about adb permissions might ring some bells http://stackoverflow.com/questions/7399028/android-adb-permission-denied. – prashant Nov 11 '15 at 15:39
  • Thanks but did not help. Also, I don't have problems running adb shell, as the OP there did. – Zsolt Szatmari Nov 11 '15 at 15:48

3 Answers3

0

The final solution was to root the device, then upgrade to 4.4 with CyanogenMod. Now everything works!

Zsolt Szatmari
  • 1,219
  • 1
  • 12
  • 29
-2

try adding this

android.permission.INTERACT_ACROSS_USERS_FULL
android.permission.INSTALL_PACKAGES

also you have a nullpointer exception there, try to add them first, then fix the exception and last clean your project to run it

Carlos Carrizales
  • 2,340
  • 3
  • 18
  • 24
-2

You need to add below permission in your AndroidManifest.xml

uses-permission android:name="android.permission.INSTALL_PACKAGES

pRaNaY
  • 24,642
  • 24
  • 96
  • 146