标签:
作为一名程序员,有的时候并不是使用软件,而是去改造软件,不仅仅只是会编程而已,还要满足客户的需求。这样,才能开发出符合客户需求的应用,在关于到涉及到android底层的应用的时候,手机就需要root了,我使用的root工具是下面一款软件,这款软件对手机root之后,这款软件卸载后,手机将不具有root权限,所以使用者可以大大放心,我之前的时候担心手机root完了之后手机有风险,这下不用担心了,下图是我已经root后的手机界面:
root完手机之后,如果我们自己开发了一款app或者发现了一个好用的app,安装到手机上之后,但是我们在恢复出厂设置之后还需要重新下载安装,免不了不少麻烦,或者可能有其他的需求,需要我们将自己客户的应用变为系统的应用,不让用户随意卸载。
第一步:手机需要有root权限
android系统本是linux系统,熟悉linux命令的程序员都知道,在linux系统中,权限很重要,当普通用户切换为root用户的时候使用的是su命令,android系统的底层也是linux内核,所以一个原理,android为了系统的安全,默认的不是root角色登陆,如果想使用root权限,需要使用su命令,但是在android系统中/system是只读权限,如果想修改权限,就需要chmod命令,chmod命令又是只有root角色才可以运行,就这样形成了一个死循环,所以一般的方法就不能获得root权限。
第二步:使用命令修改权限
下面是我操作的命令:
Windows PowerShell 版权所有 (C) 2009 Microsoft Corporation。保留所有权利。 PS C:\Users\Administrator> adb shell shell@android:/ $ su su root@android:/ # ll ll drwxr-xr-x root root 2016-01-08 15:52 acct -rw-r--r-- root root 2503 1970-01-01 08:00 advanced_meta_init.project.rc -rw-r--r-- root root 32580 1970-01-01 08:00 advanced_meta_init.rc drwxr-xr-x system system 1970-01-01 08:00 apps drwxrwx--- system cache 2016-01-08 15:35 cache dr-x------ root root 2016-01-08 15:52 config lrwxrwxrwx root root 2016-01-08 15:52 d -> /sys/kernel/debug drwxrwx--x system system 2016-01-08 16:04 data -rw-r--r-- root root 173 1970-01-01 08:00 default.prop drwxr-xr-x root root 2016-01-08 16:02 dev lrwxrwxrwx root root 1970-01-01 08:00 emmc@android -> /dev/block/mmcblk0p4 lrwxrwxrwx root root 1970-01-01 08:00 emmc@apps -> /dev/block/mmcblk0p3 lrwxrwxrwx root root 1970-01-01 08:00 emmc@cache -> /dev/block/mmcblk0p5 lrwxrwxrwx root root 1970-01-01 08:00 emmc@ebr1 -> /dev/block/mmcblk0p1 lrwxrwxrwx root root 1970-01-01 08:00 emmc@fat -> /dev/block/mmcblk0p7 lrwxrwxrwx root root 1970-01-01 08:00 emmc@sec_ro -> /dev/block/mmcblk0p2 lrwxrwxrwx root root 1970-01-01 08:00 emmc@usrdata -> /dev/block/mmcblk0p6 lrwxrwxrwx root root 2016-01-08 15:52 etc -> /system/etc lrwxrwxrwx root root 2016-01-08 15:52 external_sd -> /mnt/sdcard/external_sd -rwxr-x--- root root 143920 1970-01-01 08:00 init -rwxr-x--- root root 93 1970-01-01 08:00 init.aee.customer.rc -rwxr-x--- root root 13573 1970-01-01 08:00 init.factory.rc -rwxr-x--- root root 2344 1970-01-01 08:00 init.goldfish.rc -rwxr-x--- root root 3137 1970-01-01 08:00 init.project.rc -rwxr-x--- root root 38576 1970-01-01 08:00 init.rc -rwxr-x--- root root 16181 1970-01-01 08:00 init.usb.rc -rwxr-x--- root root 583 1970-01-01 08:00 init.xlog.rc -rw-r--r-- root root 10520 1970-01-01 08:00 meta_init.rc drwxrwxr-x root system 2016-01-08 15:52 mnt dr-xr-xr-x root root 1970-01-01 08:00 proc lrwxrwxrwx root root 1970-01-01 08:00 res -> /system/res drwx------ root root 2014-10-23 17:41 root drwxr-x--- root root 1970-01-01 08:00 sbin lrwxrwxrwx root root 2016-01-08 15:52 sdcard -> /mnt/sdcard lrwxrwxrwx root root 2016-01-08 15:52 sdcard2 -> /mnt/sdcard/external_sd drwxr-xr-x root root 2016-01-08 15:52 sys drwxr-xr-x root root 2016-01-08 15:45 system -rw-r--r-- root root 272 1970-01-01 08:00 ueventd.goldfish.rc -rw-r--r-- root root 4866 1970-01-01 08:00 ueventd.rc lrwxrwxrwx root root 2016-01-08 15:52 vendor -> /system/vendor root@android:/ # chmod 777 system chmod 777 system Unable to chmod system: Read-only file system 10|root@android:/ # mount -o rw,remount yaffs2 /system mount -o rw,remount yaffs2 /system root@android:/ # ll ll drwxr-xr-x root root 2016-01-08 15:52 acct -rw-r--r-- root root 2503 1970-01-01 08:00 advanced_meta_init.project.rc -rw-r--r-- root root 32580 1970-01-01 08:00 advanced_meta_init.rc drwxr-xr-x system system 1970-01-01 08:00 apps drwxrwx--- system cache 2016-01-08 15:35 cache dr-x------ root root 2016-01-08 15:52 config lrwxrwxrwx root root 2016-01-08 15:52 d -> /sys/kernel/debug drwxrwx--x system system 2016-01-08 16:04 data -rw-r--r-- root root 173 1970-01-01 08:00 default.prop drwxr-xr-x root root 2016-01-08 16:02 dev lrwxrwxrwx root root 1970-01-01 08:00 emmc@android -> /dev/block/mmcblk0p4 lrwxrwxrwx root root 1970-01-01 08:00 emmc@apps -> /dev/block/mmcblk0p3 lrwxrwxrwx root root 1970-01-01 08:00 emmc@cache -> /dev/block/mmcblk0p5 lrwxrwxrwx root root 1970-01-01 08:00 emmc@ebr1 -> /dev/block/mmcblk0p1 lrwxrwxrwx root root 1970-01-01 08:00 emmc@fat -> /dev/block/mmcblk0p7 lrwxrwxrwx root root 1970-01-01 08:00 emmc@sec_ro -> /dev/block/mmcblk0p2 lrwxrwxrwx root root 1970-01-01 08:00 emmc@usrdata -> /dev/block/mmcblk0p6 lrwxrwxrwx root root 2016-01-08 15:52 etc -> /system/etc lrwxrwxrwx root root 2016-01-08 15:52 external_sd -> /mnt/sdcard/external_sd -rwxr-x--- root root 143920 1970-01-01 08:00 init -rwxr-x--- root root 93 1970-01-01 08:00 init.aee.customer.rc -rwxr-x--- root root 13573 1970-01-01 08:00 init.factory.rc -rwxr-x--- root root 2344 1970-01-01 08:00 init.goldfish.rc -rwxr-x--- root root 3137 1970-01-01 08:00 init.project.rc -rwxr-x--- root root 38576 1970-01-01 08:00 init.rc -rwxr-x--- root root 16181 1970-01-01 08:00 init.usb.rc -rwxr-x--- root root 583 1970-01-01 08:00 init.xlog.rc -rw-r--r-- root root 10520 1970-01-01 08:00 meta_init.rc drwxrwxr-x root system 2016-01-08 15:52 mnt dr-xr-xr-x root root 1970-01-01 08:00 proc lrwxrwxrwx root root 1970-01-01 08:00 res -> /system/res drwx------ root root 2014-10-23 17:41 root drwxr-x--- root root 1970-01-01 08:00 sbin lrwxrwxrwx root root 2016-01-08 15:52 sdcard -> /mnt/sdcard lrwxrwxrwx root root 2016-01-08 15:52 sdcard2 -> /mnt/sdcard/external_sd drwxr-xr-x root root 2016-01-08 15:52 sys drwxr-xr-x root root 2016-01-08 15:45 system -rw-r--r-- root root 272 1970-01-01 08:00 ueventd.goldfish.rc -rw-r--r-- root root 4866 1970-01-01 08:00 ueventd.rc lrwxrwxrwx root root 2016-01-08 15:52 vendor -> /system/vendor root@android:/ # chmod 777 system chmod 777 system root@android:/ # ll ll drwxr-xr-x root root 2016-01-08 15:52 acct -rw-r--r-- root root 2503 1970-01-01 08:00 advanced_meta_init.project.rc -rw-r--r-- root root 32580 1970-01-01 08:00 advanced_meta_init.rc drwxr-xr-x system system 1970-01-01 08:00 apps drwxrwx--- system cache 2016-01-08 15:35 cache dr-x------ root root 2016-01-08 15:52 config lrwxrwxrwx root root 2016-01-08 15:52 d -> /sys/kernel/debug drwxrwx--x system system 2016-01-08 16:04 data -rw-r--r-- root root 173 1970-01-01 08:00 default.prop drwxr-xr-x root root 2016-01-08 16:02 dev lrwxrwxrwx root root 1970-01-01 08:00 emmc@android -> /dev/block/mmcblk0p4 lrwxrwxrwx root root 1970-01-01 08:00 emmc@apps -> /dev/block/mmcblk0p3 lrwxrwxrwx root root 1970-01-01 08:00 emmc@cache -> /dev/block/mmcblk0p5 lrwxrwxrwx root root 1970-01-01 08:00 emmc@ebr1 -> /dev/block/mmcblk0p1 lrwxrwxrwx root root 1970-01-01 08:00 emmc@fat -> /dev/block/mmcblk0p7 lrwxrwxrwx root root 1970-01-01 08:00 emmc@sec_ro -> /dev/block/mmcblk0p2 lrwxrwxrwx root root 1970-01-01 08:00 emmc@usrdata -> /dev/block/mmcblk0p6 lrwxrwxrwx root root 2016-01-08 15:52 etc -> /system/etc lrwxrwxrwx root root 2016-01-08 15:52 external_sd -> /mnt/sdcard/external_sd -rwxr-x--- root root 143920 1970-01-01 08:00 init -rwxr-x--- root root 93 1970-01-01 08:00 init.aee.customer.rc -rwxr-x--- root root 13573 1970-01-01 08:00 init.factory.rc -rwxr-x--- root root 2344 1970-01-01 08:00 init.goldfish.rc -rwxr-x--- root root 3137 1970-01-01 08:00 init.project.rc -rwxr-x--- root root 38576 1970-01-01 08:00 init.rc -rwxr-x--- root root 16181 1970-01-01 08:00 init.usb.rc -rwxr-x--- root root 583 1970-01-01 08:00 init.xlog.rc -rw-r--r-- root root 10520 1970-01-01 08:00 meta_init.rc drwxrwxr-x root system 2016-01-08 15:52 mnt dr-xr-xr-x root root 1970-01-01 08:00 proc lrwxrwxrwx root root 1970-01-01 08:00 res -> /system/res drwx------ root root 2014-10-23 17:41 root drwxr-x--- root root 1970-01-01 08:00 sbin lrwxrwxrwx root root 2016-01-08 15:52 sdcard -> /mnt/sdcard lrwxrwxrwx root root 2016-01-08 15:52 sdcard2 -> /mnt/sdcard/external_sd drwxr-xr-x root root 2016-01-08 15:52 sys drwxrwxrwx root root 2016-01-08 15:45 system -rw-r--r-- root root 272 1970-01-01 08:00 ueventd.goldfish.rc -rw-r--r-- root root 4866 1970-01-01 08:00 ueventd.rc lrwxrwxrwx root root 2016-01-08 15:52 vendor -> /system/vendor root@android:/ # cd system cd system root@android:/system # ll ll drwxr-xr-x root root 2016-01-08 15:42 app drwxr-xr-x root shell 2016-01-08 16:02 bin -rw-r--r-- root root 4469 2008-08-01 20:00 build.prop drwxr-xr-x root root 2016-01-08 15:42 etc drwxr-xr-x root root 2016-01-08 15:42 fonts drwxr-xr-x root root 2016-01-08 15:42 framework drwxr-xr-x root root 2016-01-08 15:42 lib drwxr-xr-x root root 1970-01-01 08:00 lost+found drwxr-xr-x root root 2016-01-08 15:42 media -rw-r--r-- root root 723451 2008-08-01 20:00 recovery-from-boot.p drwxr-xr-x root root 2016-01-08 15:42 res -rw-r--r-- root root 183 2008-08-01 20:00 sdcard0.sh -rw-r--r-- root root 183 2008-08-01 20:00 sdcard1.sh drwxr-xr-x root root 1970-01-01 08:00 secro drwxr-xr-x root root 2016-01-08 15:42 tts drwxr-xr-x root root 2016-01-08 15:42 usr drwxr-xr-x root shell 2016-01-08 15:42 vendor drwxr-xr-x root root 2016-01-08 15:42 weather drwxr-xr-x root shell 2016-01-08 15:42 xbin root@android:/system # chmod 777 app chmod 777 app root@android:/system # PS C:\Users\Administrator> adb shell
第三步:将app导入 /system/app 目录
mv weixin638android680.apk /system/app
failed on ‘weixin638android680.apk‘ - Cross-device link
标签:
原文地址:http://www.cnblogs.com/zhjsll/p/5113920.html