Push my apk to /system/app

How can I push my application package to Android emulator "/system/app" folder?

I've already tried to use:
"adb push myApk.apk /system/app"
and it gives me this:

"failed to copy: ... No space left on device"

Although from settings -> sdCard & Phone Storage, I get 37Mb of internal free space.

The whole point of this need is
related to permissions.

I need to have INSTALL_PACKAGES permission
and I know that by puting my application there,
in /system/app, I get that permission.


Asked by: Melissa722 | Posted: 25-01-2022






Answer 1

I can install an APK to /system/app with following steps.

  1. Push APK to SD card.

    $ adb push SecureSetting.apk /sdcard/  
    
  2. Enter the console and get the shell

    $ adb shell
    
  3. Switch to superuser. If your device is not rooted, get it rooted first. (If you don't know how to do that, just Google.)

    $ su 
    
  4. Remount the system partition with WRITE permission.

    $ mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system 
    
  5. Cat your APK from /sdcard/ to /system/ , some guys get a fail with cp command due to cp is not supported. So use cat instead.

    $ cat /sdcard/SecureSetting.apk > /system/app/SecureSetting.apk 
    
  6. Remout /system partition back to READ-ONLY, and exit

    $ mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system
    $ exit
    

Then reboot your device, the APK should have been installed on /system/app.

Answered by: Connie153 | Posted: 26-02-2022



Answer 2

Normally, the only way to get access to the "/system/" directory is to have a device rooted. I don't exactly know if that is required for the emulator though. That could be your issue.

Answered by: John400 | Posted: 26-02-2022



Answer 3

These are the steps if you are installing a system apk for Android 5.0 or later devices. For older versions use posaidong's answer

Rename your apk file to base.apk

$ adb push base.apk /sdcard/  

Enter the console and get the shell

$ adb shell

Switch to superuser. If your device is not rooted, get it rooted first. (If you don't know how to do that, just Google.)

$ su 

Remount the system partition with WRITE permission.

$ mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system 

Create a Test directory inside /system/app folder. (or can use /system/priv-app as well). Ideally this folder name should be application name. For now, lets use Test

$ mkdir /system/app/Test 

Requires 755 permission for this dir

$ chmod 755 /system/app/Test 

Copy your base.apk inside

$ cat /sdcard/base.apk > /system/app/Test/Base.apk 

Remout /system partition back to READ-ONLY, and exit

$chmod 644 /system/app/Test/Base.apk 

Requires 644 permission for this dir

$ mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system

$ exit

Reboot your device. When boot completes you should see a system message like Android updating ...

Answered by: Nicole938 | Posted: 26-02-2022



Answer 4

settings -> sdCard & phone storage says about /data folder.

/system is mounted separately and I guess there is no way of writing there unless you make your own Android build.

See mounts by running

adb shell

# df

Answered by: Julian780 | Posted: 26-02-2022



Answer 5

I have come across this situation multiple times while copying apk files to /system partition and could finally resolve it using the following steps:

  • Check the Free space in /system partition using df from adb shell. Most probably the Free space would be less than size of apk file.

    Filesystem               Size     Used     Free   Blksize
    /dev                         1.3G    80.0K     1.3G      4.0K
    /sys/fs/cgroup               1.3G    12.0K     1.3G      4.0K
    /mnt/secure                  1.3G     0.0K     1.3G      4.0K
    /mnt/asec                    1.3G     0.0K     1.3G      4.0K
    /mnt/obb                     1.3G     0.0K     1.3G      4.0K
    /system                      3.5G     3.5G    10.0M      4.0K
    /efs                        15.7M     2.8M    12.9M      4.0K
    /cache                     192.8M   736.0K   192.1M      4.0K
    /data                       25.5G    12.7G    12.8G      4.0K
    /persdata/absolute           4.9M   120.0K     4.8M      4.0K
    /sbfs                       10.8M     8.0K    10.7M      4.0K
    /mnt/shell/knox-emulated    25.5G    12.7G    12.8G      4.0K
    /mnt/shell/privatemode      25.4G    12.7G    12.7G      4.0K
    /mnt/shell/emulated         25.4G    12.7G    12.7G      4.0K
    /preload                     5.8M     3.3M     2.5M      4.0K
    
  • Use du /system to get sizes of each folder & file in /system partition. Arrange the output in descending order of size(s) to get (something similar):

    4091840 /system/
    1199416 /system/app
    964064  /system/priv-app
    558616  /system/lib64
    373320  /system/lib
    206624  /system/vendor
    170952  /system/app/WebViewGoogle
    148824  /system/app/WebViewGoogle/lib
    125488  /system/voice
    125480  /system/voice/embedded
    122880  /system/app/Chrome
    106520  /system/framework
    102224  /system/priv-app/Velvet
    96552   /system/app/SBrowser_3.0.38
    93936   /system/vendor/lib64
    93792   /system/vendor/lib64/egl
    92552   /system/tts
    92512   /system/tts/lang_SMT
    ...
    
  • Delete unnecessary files from /system/voice/embedded, /system/tts/lang_SMT (for language/locale support) and/or other folders to free enough space in /system partition to accommodate the new apk file. Deleting files in partitions other than /system may not help in this scenario. (N.B.: This step may require ROOT privileges and remounting /system partition in read-write mode using mount -o rw,remount /system)

Answered by: Daryl936 | Posted: 26-02-2022



Answer 6

You need to run adb remount first, then it should let you adb pushto /system folders

Answered by: Cherry190 | Posted: 26-02-2022



Answer 7

The following batch file will install any apk files in the folder to the /system/app directory. It mounts the system drive as rw, then copies the files over.

To use it, put the following code into a text editor and save it as install.bat on a Windows machine. Then double-click on the batch file to install any APK files that are in the same folder as the batch file.

NOTE: You can't remount the system partition unless you have root on the device. I've mostly used this on the emulator which defaults to root (And was the original question), but the concept should be the same on a physical device.

@ECHO OFF
%~d0
CD %~dp0
adb root
adb shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
adb shell rm /system/app/SdkSetup.apk
for /f %%a IN ('dir /b *.apk') do adb push %%a /system/app/.

Answered by: Kevin157 | Posted: 26-02-2022



Answer 8

Use below commands from your super user ADB shell. Copy the APK of your APP into your SD card or Internal Storage.

$ adb shell
$ su
$ mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system 
$ cp /sdcard/<Your_APK_PATH> /system/app/file_name_comes_here.apk
$ chmod 644 /system/app/<YourAPK>.apk

Then reboot the device

Answered by: Adelaide99 | Posted: 26-02-2022



Answer 9

You have to mount system as read/write and then push the application.

This is answered in this question: Push .apk to /system/app/ in HTC HERO

Answered by: Lyndon392 | Posted: 26-02-2022



Answer 10

Even before adb remount you should change the permissions for the /system in the adb shell. you can use chmod to change the permissions.

Answered by: Sophia469 | Posted: 26-02-2022



Answer 11

If your apk is smaller enough to push in, then try some times again. I met the same problem and tried twice to push the apks to /system/app/

Answered by: Arnold441 | Posted: 26-02-2022



Answer 12

Apparently, there is not enough space for your application in "/system" mount. You can check that with "adb shell df" command.

To solve this issue, you need to set partition-size parameter adequately while starting your AVD like this:

emulator.exe -avd <your avd name> -partition-size 512

Answered by: Haris363 | Posted: 26-02-2022



Answer 13

Check that you have enough inodes, you may have enough memory but not enough inode i.e. file placeholder.

Answered by: Roland658 | Posted: 26-02-2022



Answer 14

If you're simply looking to install it, you can always do: adb install myApk.apk.

Answered by: Blake845 | Posted: 26-02-2022



Similar questions

android - Why doesn't program in /system/app get SuperUser access?

We are creating an Android application which requires super user privileges. The SuperUser.apk and su are installed. However there seems to be a difference between installing our application in /data/app vs. /system/app. If we install in /data/app, everything seems to work fine. If we install in /system/app, SuperUser.apk does not popup to grant privileges. Are there certain types of programs that must be installed...


android - How to uninstall own app from /system/app?

I'm able to install own application into /system/app using adb shell commands. But how to uninstall it? Is there any commands to do it? My phone is rooted.


android - Install app from Eclipse to /system/app at compile time

I'm installing my application in /system/app folder. But it very difficult every time use ADB for do it. Is there any way to install app at compile time from Eclipse to /system/app folder? This commands I'm using for install. But I want avtomate this commands from Eclipse when I press Run button. How can I do it? adb push C:\XXX.apk /sdcard/XXX.apk adb shell su mount -t rfs -o remount,rw /dev/block/...


android - How to upgrade app in /system/app?

We've Android app 1.0 and make it in /system/app for the special ROM. Now we have released upgrade version 1.1 of that app, after installation, the version is changed to 1.1 in App list in Android settings. But when I reboot the system, the updated version is missed, back in 1.0. How resolve this problem? Any detailed introductions about it? Thanks.


android - Find the APK names for /system/app

How to find the apk names for /system/app? because some of the apk names are not in "pm list packages -f" they are all system apps and I just need to know the APK names like an example below for "com.android.systemui" is "SystemUI.apk" adb shell ps |grep u0_ u0_a98 2612 1936 542612 39060 ffffffff 00000000 S com.android.systemui u0_a29 2712 1936 528736 32312 ffffffff 00000000 S android.process.medi...


Can an Android app in /system/app write into /system on unrooted device?

I'm developing an app that will be included in the ROM of a phone vendor's new product. So this is the situation I'm facing: my app resides in /system/app; but the device is NOT rooted. My question is, can my app somehow write into the /system folder? I know the system partition is usually read-only. Is it possible for my app to remount the system partition as read-write, write into it...


adb - .apk file getting removed from /system/app directory on android 4.1.2

I am trying to install an app on android 4.1.2 using adb shell. This is an app in development which works well on higher android version placed under /system/priv-app/ directory. So this is what I am doing su mount -o remount,rw /system cat /sdcard/myapp.apk &gt; /system/app/myapp.apk chmod 644 /system/app/myapp.apk reboot Before reboot i verified the file was placed under /system/app with...


Can an Android app installed in /system/app folder access privileged ports?

Is an app installed in the /system/app folder automatically qualified as a system app with all the privileges (to be honest, I am not sure what all the privileges are). I installed an app in /system/app, but it still gets the same error: exception:bind failed: EACCES (Permission denied) The code that generates the exception is: DatagramSocket socket = new DatagramS...


In Android phone, after move .apk from /data/app to /system/app, can I use "adb shell pm list package -f" get .apk's true path?

In Android phone, after move .apk from /data/app to /system/app, can I use &quot;adb shell pm list package -f&quot; get .apk's true path? I have not android phone with root, so I can't test it.






Still can't find your answer? Check out these communities...



Android Google Support | Android Community | Android Community (Facebook) | Dev.io Android



top