1

I'm trying to write my first android app, I have alreadu managed to test it and debug on my Tablet which runs Android 4.4 but I couldn't run it on my mobile phone which runs Android 5.1.1 I googled it everywhere but I couldn't find any solution.. I have downloaded A-L-L SDK files (costed me about 60 GB) and still nothing works.. The main error is this:

enter image description here

on the Run console it says this:

    pkg: /data/local/tmp/yarden4.myappsname
Error: java.lang.SecurityException: Neither user 2000 nor current process has android.permission.INSTALL_PACKAGES.

here is a logcat cropped to the specific time where I try to run:

12-16 03:19:16.543 16411-16411/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 2000 <<<<<<
12-16 03:19:16.547 16411-16411/? D/AndroidRuntime: CheckJNI is OFF
12-16 03:19:16.653 16411-16411/? D/AndroidRuntime: Calling main entry com.android.commands.pm.Pm
12-16 03:19:16.660 16411-16411/? E/Pm: Error
                                       java.lang.SecurityException: Neither user 2000 nor current process has android.permission.INSTALL_PACKAGES.
                                           at android.os.Parcel.readException(Parcel.java:1553)
                                           at android.os.Parcel.readException(Parcel.java:1505)
                                           at android.content.pm.IPackageManager$Stub$Proxy.installPackageAsUser(IPackageManager.java:3033)
                                           at com.android.commands.pm.Pm.runInstall(Pm.java:958)
                                           at com.android.commands.pm.Pm.run(Pm.java:143)
                                           at com.android.commands.pm.Pm.main(Pm.java:101)
                                           at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
                                           at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:249)
12-16 03:19:16.662 16411-16411/? I/art: System.exit called, status: 1
12-16 03:19:16.662 16411-16411/? I/AndroidRuntime: VM exiting with result code 1.

I also tried: reinstalling android studio / searching for the app installed somehow on my phone (its nor in app list and nor in data/app folders) / messing with google play service app.. / tried different apps.. even a clean neat hello world won't run.. and I'll mention again.. it works fine on my tablet.

P.S my phone and tablet are rooted + xposed + non original ROMs (both)

any idea what to do? I'm stuck for days with this thing.. :(

Thanks ALOT ahead!

Yarden Cohen
  • 584
  • 2
  • 4
  • 19
  • Just curious, why did you download all the SDK tools? The minimum you need is the API you are targeting. The max is anything above that - you don't even need the latest unless you are developing for it specifically. – OneCricketeer Dec 16 '15 at 02:44
  • Also, see the answers on [this question](https://stackoverflow.com/questions/23453942/neither-user-10051-nor-current-process-has-android-permission-install-packages) – OneCricketeer Dec 16 '15 at 02:45
  • Downloading SDk's blindly doesn't make any sense ,Before doing anything must read the respective document. – learner Dec 21 '15 at 09:39

3 Answers3

1

Ok I don't quite sure what was exactly the problem but I have managed to solve it.

The solution was to switch ROM.. :\ I just flashed a different ROM from the same version, pretty much the same.. I didn't even wipe anything so I left with everything I had.. but that fixed it..

I Hope that might help someone else as well.

Yarden Cohen
  • 584
  • 2
  • 4
  • 19
0

You can add the following line in your permissions, in your Android manifest file

<uses-permission android:name="android.permission.INSTALL_PACKAGES" /> 

If the problem remains: - Clean and rebuild - Check if your phone didn't have some permissions turned off

You can finally give a look to this link if none of the solutions above are working: Permission is only granted to system app

Community
  • 1
  • 1
Virthuss
  • 3,142
  • 1
  • 21
  • 39
  • 1
    Wow I had so much hope and none of the above worked!! :/ first of all, I tried cleaning.. I tried the simple 'hello world' app. it gave the same error. also the permission for INSTALL_PACKAGES is for system apps.. I don't need that permission on my app and it gave an error when I tried to add that.. I also tried the link showing how to avoid that error and even though it removed the warning it still didn't fix the problem.. And for @cricket_007: I tried all SDK to be 100% sure thats not it, as im not quite sure what is everything there.. and also your link didn't help either :(( – Yarden Cohen Dec 17 '15 at 13:25
0

If you are here because you rename your project directory and gotten the following error:

enter image description here

The solution is to simply go to menu > Build > Clean Project. Then, click run app (the green arrow).

This will force the project to clean up those build at app/build which i think is causing problem.

ytbryan
  • 2,644
  • 31
  • 49