How to replace / uninstall Email application from android emulator - android

Is there any way to uninstall/replace the inbuilt application in android emulator so that i can install my customized apps for Mail, Contacts, Music etc.
I have downloaded android 2.2 code for Email application and i want to modify certain things and install.
Please let me know if there is any way.

There's no point in replacing the apps in /system while the emulator is running, since the emulator doesn't save /system anyway.
In order to permanently replace apps in /system, one can edit the system.img file. It's quite easy really. As easy as extracting, moving files around, and compressing it back.
http://www.rodneybeede.com/Customize_an_Android_system_img.html

I have done this way:
adb shell
mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system
mount -o remount,rw -t yaffs2 /dev/block/mtdblock1 /data
rm /system/app/MyAppName.apk
rm -rf /data/data/package_name_here/
mount -o remount,ro -t yaffs2 /dev/block/mtdblock0 /system
mount -o remount,ro -t yaffs2 /dev/block/mtdblock1 /data
pm uninstall package_name_here
exit
Take care points:
You have to provide details of your application:
Line number 4: rm /system/app/MyAppName.apk
Line number 5: rm -rf /data/data/package_name_here/
Line number 8: pm uninstall package_name_here
Done

Launch your emulator, then make sure it is connected via adb, by typing:
adb -e devices
Make /system writable, by typing:
adb -e remount
Backup & remove Email.apk:
adb -e pull /system/app/Email.apk
adb -e rm /system/app/Email.apk
Push you own Email.apk:
adb -e push Email.apk /system/app
That's about it.

All i can say is i am also trying to find the solution but you can try an alternative, try uninstalling unnecessary apps by system app remover and now installing a application similar for the same purpose from market and see if it works the same.

Related

Can't mount system android : read file only [duplicate]

I recently rooted my Droid X and everything seems to be working perfectly. I made some changes to build.prop and when I do adb push build.prop /system/ I get the following error: failed to copy 'c:\build.prop' to '/system//build.prop': Read-only file system.
How can I fix this?
Not all phones and versions of android have things mounted the same.
Limiting options when remounting would be best.
Simply remount as rw (Read/Write):
# mount -o rw,remount /system
Once you are done making changes, remount to ro (read-only):
# mount -o ro,remount /system
adb remount
works for me and seems to be the simplest solution.
While I know the question is about the real device, in case someone got here with a similar issue in the emulator, with whatever tools are the latest as of Feb, 2017, the emulator needs to be launched from the command line with:
-writable-system
For anything to be writable to the /system. Without this flag no combination of remount or mount will allow one to write to /system.
After the emulator is launched with that flag, a single adb remount after adb root is sufficient to get permissions to push to /system.
Here's an example of the command line I use to run my emulator:
./emulator -writable-system -avd Nexus_5_API_25 -no-snapshot-load -qemu
The value for the -avd flags comes from:
./emulator -list-avds
Got this off an Android forum where I asked the same question. Hope this helps somebody else.
On a terminal emulator on the phone:
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
Then on the cmd prompt, do the adb push
I think the safest way is remounting the /system as read-write, using:
mount -o remount,rw /system
and when done, remount it as read-only:
mount -o remount,ro /system
adb disable-verity
adb reboot
adb root
adb remount
This works for me, and is the simplest solution.
On my Samsung galaxy mini S5570 (after got root on cellphone):
Fist, as root, I ran:
systemctl start adb
as a normal user:
adb shell
su
Grant root permissions on touch screen
mount
list all mount points that we have and we can see, in my case, that /dev/stl12 was mounted on /system as ro (ready only), so we just need do:
mount -o rw,remount /dev/stl12 /system
Try the following on the command prompt:
>adb remount
>adb push framework-res_old.apk /system/framework-res.apk
Here is what worked for me. I was running an emulated Android 7.1.1 (Nougat) device.
On a terminal, I hit the following command. One thing to be noticed is the -writable-system flag
./emulator -writable-system -avd Nexus_6_API_25 -partition-size 280
On another tab
./adb shell
su
mount -o rw,remount -t ext4 /dev/block/vda /system
All the changes that you do on the /system contents will survive a restart.
I checked with emulator and following worked.
adb reboot
adb root && adb remount && adb push ~/Desktop/hosts /system/etc/hosts
As mentioned above as well, execute second step in single shot.
Open terminal emulator on the phone:
then
adb shell
after that daemon is started
su
mount -o rw,remount /mnt/sdcard
then the read only is converted into the read-Write.
Sometimes you get the error because the destination location in phone are not exist. For example, some android phone external storage location is /storage/emulated/legacy instead of /storage/emulated/0.
mount -o rw,remount /dev/stl12 /system
works for me
This worked for me
#Mount as ReadOnly
su -c "mount -o rw,remount /system"
# Change Permission for file
su -c "chmod 777 /system/build.prop"
#Edit the file to add the property
su -c "busybox vi /system/build.prop"
# Add now
service.adb.tcp.port=5678
# Reset old permissions
su -c "chmod 644 /system/build.prop"
# Mount as readonly again once done
su -c "mount -o ro,remount /system"
I found this article from google, and thought I'd add the steps necessary on a Sony Xperia Z (4.2.2).
The Sony has a watchdog process which detects when you've changed ro to rw on / and /system (these are the only ones I was trying to modify) and possibly others.
The following was what I ran to perform the changes I was trying to achieve. I pasted these into a window, because removing the execute bit from /sbin/ric needs to be done quickly in order to stop it restarting itself. (I tried stop ric; this doesn't work - although it worked on a previous version of android on the phone).
pkill -9 ric; mount -o rw,remount -t rootfs /
chmod 640 /sbin/ric
mount -o rw,remount /system
I modified the hosts file here, so this is the place you make the changes you need to the filesystem. To leave things the way we found them, do this:
mount -o ro,remount /system
chmod 750 /sbin/ric
mount -o ro,remount -t rootfs /
At which point ric should automatically restart. (It restarted for me automatically.)
Adding a little bit more to Jan Bergström's answer: Because Android is a Linux based system, and the path in Linux contains forward slashes(../), while using push command, use "/" to define destination path in the Android device.
For Example, the command goes: adb push C:\Users\admin\Desktop\1.JPG sdcard/pictures/
Notice that here, back slashes are used to define source path of the file to be pushed from windows PC and forward slashes are used to define destination path because Android is a Linux based system. You don't have to act as a root to use this command and also, it works perfectly fine on production devices.
Thanks, Sérgio, for "mount" command without parameters idea.
I'd need to made adb push into /data/data/com.my.app/lib for some test issue, and get "Read-only filesystem" message.
ls command shows me:
root#android:/ # ls -l /data/data/com.my.app/
drwxrwx--x u0_a98 u0_a98 2016-05-06 09:16 cache
drwxrwx--x u0_a98 u0_a98 2016-05-06 09:04 files
lrwxrwxrwx system system 2016-05-06 11:43 lib -> /mnt/asec/com.my.app-1/lib
So, it's understood, that "lib" directory is separated from other application directories.
Command
mount -o rw,remount /mnt/asec
didn't resolve "r/o fs" issue, it wants device parameter before directory parameter.
"df" command didn't help also, but shows that my /mnt/asec/com.my.app-1 directory is at the separate mount point.
Then I looks by mount and voila!
root#android:/ # mount
.........
/dev/block/dm-4 /mnt/asec/com.my.app-1 ext4 ro,dirsync,relatime 0 0
Next steps are already described upwards: remount to RW, push and remount back to RO.
it sames that must extract and repack initrc.img and edit init file with the code of mount /system
Copy files to the SD-card?
Well, I assume you like to copy data to the Sd-card from the developers computer? You might have rooted the devise and made the area you address available?) I had about the same problem to upload data files for my application(Android Studio 1.3.2 in Win7), but.
First the adb command-shell has to be found in th path:
PATH=%PATH%;C:\Users\XXXXX\AppData\Local\Android\sdk\platform-tools (the folder AppData is hidden, so you have to set the folder setup not hiding concealed files and folder to find it, Path works regardless)
You have to spell the folder path right or you get a read-only error message, most likely it must start with /sdcard or it is read only area. As soon as I did no problem pushing the file to the emulator.
So for instance the the adb command can look like this:
adb push C:\testdata\t.txt /sdcard/download/t.txt
If there's a failure in copying the read-only file you can try locating the original file in the root directory and modify it with a root text editor (preferably) RB text editor, it comes with ROM Toolbox app.
Try this in a Terminal Emulator as root:
restorecon -v -R /data/media
In my case I was using the command adb push ~/Desktop/file.txt ~/sdcard/
I changed it to ~/Desktop/file.txt /sdcard/ and then it worked.
Make sure to disconnect and reconnect the phone.
As chen-xing mentioned the simplest way is:
adb reboot
But for me I had to change my settings first:
Settings → Developer options → Root access
Make sure ADB has Root access:
I just only needed this:
su -c "mount -o rw,remount /system"

Simple mount will not work (Android Emulator)

I need to remount the /system directory read write on the Android emulator I am using, I have root access but still no success. I am running the shell via adb, I have tried the following combinations:
mount -o rw,remount /system
mount -o remount,rw /system
I am lost, please help.
p.s I am running the emulator through ubuntu although i don't think this should make a difference

Read only file system on Android

I recently rooted my Droid X and everything seems to be working perfectly. I made some changes to build.prop and when I do adb push build.prop /system/ I get the following error: failed to copy 'c:\build.prop' to '/system//build.prop': Read-only file system.
How can I fix this?
Not all phones and versions of android have things mounted the same.
Limiting options when remounting would be best.
Simply remount as rw (Read/Write):
# mount -o rw,remount /system
Once you are done making changes, remount to ro (read-only):
# mount -o ro,remount /system
adb remount
works for me and seems to be the simplest solution.
While I know the question is about the real device, in case someone got here with a similar issue in the emulator, with whatever tools are the latest as of Feb, 2017, the emulator needs to be launched from the command line with:
-writable-system
For anything to be writable to the /system. Without this flag no combination of remount or mount will allow one to write to /system.
After the emulator is launched with that flag, a single adb remount after adb root is sufficient to get permissions to push to /system.
Here's an example of the command line I use to run my emulator:
./emulator -writable-system -avd Nexus_5_API_25 -no-snapshot-load -qemu
The value for the -avd flags comes from:
./emulator -list-avds
Got this off an Android forum where I asked the same question. Hope this helps somebody else.
On a terminal emulator on the phone:
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
Then on the cmd prompt, do the adb push
I think the safest way is remounting the /system as read-write, using:
mount -o remount,rw /system
and when done, remount it as read-only:
mount -o remount,ro /system
adb disable-verity
adb reboot
adb root
adb remount
This works for me, and is the simplest solution.
On my Samsung galaxy mini S5570 (after got root on cellphone):
Fist, as root, I ran:
systemctl start adb
as a normal user:
adb shell
su
Grant root permissions on touch screen
mount
list all mount points that we have and we can see, in my case, that /dev/stl12 was mounted on /system as ro (ready only), so we just need do:
mount -o rw,remount /dev/stl12 /system
Try the following on the command prompt:
>adb remount
>adb push framework-res_old.apk /system/framework-res.apk
Here is what worked for me. I was running an emulated Android 7.1.1 (Nougat) device.
On a terminal, I hit the following command. One thing to be noticed is the -writable-system flag
./emulator -writable-system -avd Nexus_6_API_25 -partition-size 280
On another tab
./adb shell
su
mount -o rw,remount -t ext4 /dev/block/vda /system
All the changes that you do on the /system contents will survive a restart.
I checked with emulator and following worked.
adb reboot
adb root && adb remount && adb push ~/Desktop/hosts /system/etc/hosts
As mentioned above as well, execute second step in single shot.
Open terminal emulator on the phone:
then
adb shell
after that daemon is started
su
mount -o rw,remount /mnt/sdcard
then the read only is converted into the read-Write.
Sometimes you get the error because the destination location in phone are not exist. For example, some android phone external storage location is /storage/emulated/legacy instead of /storage/emulated/0.
mount -o rw,remount /dev/stl12 /system
works for me
This worked for me
#Mount as ReadOnly
su -c "mount -o rw,remount /system"
# Change Permission for file
su -c "chmod 777 /system/build.prop"
#Edit the file to add the property
su -c "busybox vi /system/build.prop"
# Add now
service.adb.tcp.port=5678
# Reset old permissions
su -c "chmod 644 /system/build.prop"
# Mount as readonly again once done
su -c "mount -o ro,remount /system"
I found this article from google, and thought I'd add the steps necessary on a Sony Xperia Z (4.2.2).
The Sony has a watchdog process which detects when you've changed ro to rw on / and /system (these are the only ones I was trying to modify) and possibly others.
The following was what I ran to perform the changes I was trying to achieve. I pasted these into a window, because removing the execute bit from /sbin/ric needs to be done quickly in order to stop it restarting itself. (I tried stop ric; this doesn't work - although it worked on a previous version of android on the phone).
pkill -9 ric; mount -o rw,remount -t rootfs /
chmod 640 /sbin/ric
mount -o rw,remount /system
I modified the hosts file here, so this is the place you make the changes you need to the filesystem. To leave things the way we found them, do this:
mount -o ro,remount /system
chmod 750 /sbin/ric
mount -o ro,remount -t rootfs /
At which point ric should automatically restart. (It restarted for me automatically.)
Adding a little bit more to Jan Bergström's answer: Because Android is a Linux based system, and the path in Linux contains forward slashes(../), while using push command, use "/" to define destination path in the Android device.
For Example, the command goes: adb push C:\Users\admin\Desktop\1.JPG sdcard/pictures/
Notice that here, back slashes are used to define source path of the file to be pushed from windows PC and forward slashes are used to define destination path because Android is a Linux based system. You don't have to act as a root to use this command and also, it works perfectly fine on production devices.
Thanks, Sérgio, for "mount" command without parameters idea.
I'd need to made adb push into /data/data/com.my.app/lib for some test issue, and get "Read-only filesystem" message.
ls command shows me:
root#android:/ # ls -l /data/data/com.my.app/
drwxrwx--x u0_a98 u0_a98 2016-05-06 09:16 cache
drwxrwx--x u0_a98 u0_a98 2016-05-06 09:04 files
lrwxrwxrwx system system 2016-05-06 11:43 lib -> /mnt/asec/com.my.app-1/lib
So, it's understood, that "lib" directory is separated from other application directories.
Command
mount -o rw,remount /mnt/asec
didn't resolve "r/o fs" issue, it wants device parameter before directory parameter.
"df" command didn't help also, but shows that my /mnt/asec/com.my.app-1 directory is at the separate mount point.
Then I looks by mount and voila!
root#android:/ # mount
.........
/dev/block/dm-4 /mnt/asec/com.my.app-1 ext4 ro,dirsync,relatime 0 0
Next steps are already described upwards: remount to RW, push and remount back to RO.
it sames that must extract and repack initrc.img and edit init file with the code of mount /system
Copy files to the SD-card?
Well, I assume you like to copy data to the Sd-card from the developers computer? You might have rooted the devise and made the area you address available?) I had about the same problem to upload data files for my application(Android Studio 1.3.2 in Win7), but.
First the adb command-shell has to be found in th path:
PATH=%PATH%;C:\Users\XXXXX\AppData\Local\Android\sdk\platform-tools (the folder AppData is hidden, so you have to set the folder setup not hiding concealed files and folder to find it, Path works regardless)
You have to spell the folder path right or you get a read-only error message, most likely it must start with /sdcard or it is read only area. As soon as I did no problem pushing the file to the emulator.
So for instance the the adb command can look like this:
adb push C:\testdata\t.txt /sdcard/download/t.txt
If there's a failure in copying the read-only file you can try locating the original file in the root directory and modify it with a root text editor (preferably) RB text editor, it comes with ROM Toolbox app.
Try this in a Terminal Emulator as root:
restorecon -v -R /data/media
In my case I was using the command adb push ~/Desktop/file.txt ~/sdcard/
I changed it to ~/Desktop/file.txt /sdcard/ and then it worked.
Make sure to disconnect and reconnect the phone.
As chen-xing mentioned the simplest way is:
adb reboot
But for me I had to change my settings first:
Settings → Developer options → Root access
Make sure ADB has Root access:
I just only needed this:
su -c "mount -o rw,remount /system"

Push .apk to /system/app/ in HTC HERO

I have an HTC HERO and
I need to push my application.apk
to the /system/app/ folder.
I've followed some tuts on rooting the device
and that is fine, but when I try to push my package to the system/app
folder, I get: "permission denied":
$ push /sdcard/myApp.apk /system/app/
push: permission denied
I also try:
$ su
su
# push /sdcard/myApp.apk /system/app/
push: not found
Is this possible in a device that is not a developer intended device?
Thank you all!
Firstly, running push from the device doesn't work as it's not a built-in command. Ideally you would use the copy command cp, but I don't think it's included by default (I've added it to my device via busybox).
Anyway, your problem is that the /system partition is mounted as read-only when the device boots.
But if you have root access to the device, you can remount the partition as read-write:
host$ adb shell
hero$ su
hero# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
hero# cat /sdcard/myApp.adk > /system/app/myApp.adk
hero# mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system
Alternatively, after doing the remount, you can use adb push from the host as normal.
How I do it:
adb shell
#su
#mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
open a second terminal and use:
adb push myApp.apk /system/app/
in first terminal:
#reboot
What I add more then the others is the reboot - it's a must when doing a remount operation on the Android devices.

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.
I can install an APK to /system/app with following steps.
Push APK to SD card.
$ adb push SecureSetting.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
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
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.
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.
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 ...
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
You need to run adb remount first, then it should let you adb pushto /system folders
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)
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/.
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
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
Even before adb remount you should change the permissions for the /system in the adb shell.
you can use chmod to change the permissions.
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/
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
Check that you have enough inodes, you may have enough memory but not enough inode i.e. file placeholder.
If you're simply looking to install it, you can always do: adb install myApk.apk.

Categories

Resources