0

maybe this is a newbie question, but I'm struggling to find an answer...

I need to install some apk as system apps. In past (up to android 5.01) I was used to just adb push to /system/app and everything was working fine.

I found out today that since Android 5.1 this doesn't work anymore as apps in that directory are not anymore simple apks but they are folders with an arm directory with actual apk and other files.

How can I now install as system apps the apks that I have?

I have sources only for 1 of them.

thanks in advance for your support

regards, blackdir

1
  • You need to create a folder with a name of your choice under /system/priv-app. Then, rename the APK to the exact name of the newly created folder and put [the APK] inside the folder. Next, change the folder's owner with chown 0.0 /system/priv-app/yourFolder and its permissions with chmod 744 /system/priv-app/yourFolder (yourFolder will be the name of the folder). Finally, do the same for the APK, with the same owners 0.0 but with 644 permissions, then reboot and see if it works.
    – Grimoire
    Commented Dec 2, 2016 at 7:27

1 Answer 1

2

In Android API Level 21+ (5.1+) modifications in /system/app will not be recognized by the package manager automatically. Insteadyou should try /system/priv-app.
Assume your app is called Foo.apk, create a folder in /system/priv-app/Foo and set chmod 755 & chown 0.0 to it. Then put your apk file in it (the path should be /system/priv-app/Foo/Foo.apk) and chmod 644 & chown 0.0 to it. It will be recognized by the package manager then, or if not just reboot you device and the app is there.
In some ROMs mods in /system/app WILL be recognized automatically but it depends.

1
  • 1
    +1: this is the correct way to do it, but you forgot about the SELinux context. In fact, some of the apps installed to /system/priv-app will crash, if their security context has not been changed to u:object_r:system_file:s0 via chcon. To summarize, after setting the appropriate ownership and permissions, one shall issue chcon u:object_r:system_file:s0 /system/priv-app/Foo and chcon u:object_r:system_file:s0 /system/priv-app/Foo/Foo.apk.
    – Grimoire
    Commented Dec 3, 2016 at 22:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .