Friday, August 9, 2019

How do I properly install a system app given its .apk?


I removed a system app (com.android.mms) and I have the .apk needed to restore it, however it won't install through the standard channels (running the .apk gives me "application not installed"). What's the proper way to install a system app's .apk?



Answer




You will need to push the .apk to the phone to the System partition to the folder /system/app or /system/priv-app when using Android 4.3 using adb. You can find more info about adb here: http://android-dls.com/wiki/index.php?title=ADB.


In order to write to /system you likely have to remount it read-write:


adb shell
su
mount -o rw,remount /system

Or, do it entirely from the host's ADB:


adb root
adb remount


Now you can place the .apk:


adb push my-app.apk /sdcard/
adb shell
su
cd /sdcard
mv my-app.apk /system/app
# or when using Android 4.3 or higher
mv my-app.apk /system/priv-app

Afterwards if the flags are not already set change the permissions. All System-Apps need to have the permissions rw-r--r--. You can also change them via ADB with the command chmod 644 /path_to/your_file. Though it's quite old, this may help



After you have placed the .apk you need to reboot your device. For example with adb reboot.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...