switching phone.apks

Discussion in 'Android Hacks and Help' started by actngrezy, May 6, 2010.

  1. actngrezy
    Offline

    actngrezy New Member Developer

    Joined:
    Mar 21, 2010
    Messages:
    1,074
    Likes Received:
    2
    Trophy Points:
    0
    Location:
    delaware
    I would like to switch my phone.apks
    So I'm obviously goign to use adb but kind of new to it have only done system formats and what not. anyway Now DO I pull the old phone.apk off first then rename it while its on my comp for safe keeping or can I rename it using root exploer then push the new phone apk onto the phone and do I need to be in recovery to pull a phone apk off because last time I tried to do this with root explorer my phone wouldnt stop f.c'ing or maybe I installed the new phone.apk and it was f.c'ing I cant remember so I just wasn't sure about those questions.
  2. actngrezy
    Offline

    actngrezy New Member Developer

    Joined:
    Mar 21, 2010
    Messages:
    1,074
    Likes Received:
    2
    Trophy Points:
    0
    Location:
    delaware
    I think This is how can soemone corrct me if I'm wrong
    adb shell
    su
    mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system
    adb shell
    exit
    exit
    adb pull /system/apps/phone.apk phone.apk
    Then rename and save it for safe keeping then push
    adb push phone.apk /system/apps phone.apk
    adb shell
    mount -o ro,remount -t yaffs2 /dev/block/mtdblock4 /system
    exit
    exit
    ----reboot the phoen and should be good correct
    I also saw a command that looked like this adb pull /system/app/phone.apk .
    and adb push ./phone.apk /app/phone.apk I didnt really understand the . in the commands whats the difference between the top ones and these 2 is there a difference or just different way to type the commands?
  3. cupfulloflol
    Offline

    cupfulloflol New Member

    Joined:
    Dec 5, 2009
    Messages:
    1,898
    Likes Received:
    22
    Trophy Points:
    0
    Remember capitalization matters.

    The way I would do it. Place the Phone.apk you want to push to your phone in the tools folder on your PC.

    Code:
    adb pull /system/app/Phone.apk Phonebackup.apk
    adb push Phone.apk /system/app/
    
    That will pull the Phone.apk from your phone to your PC, and name it Phonebackup.apk. Then push the Phone.apk to /system/app/ .

    You may have to reboot afterwards, adb reboot will work. A reboot may not be required, but sometimes it will Phone will FC and a reboot could fix this.

    You probably won't need to, but just in case you may need to change the permissions :

    Code:
    adb shell
    su
    mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system
    chmod 644 /system/app/Phone.apk
    
  4. actngrezy
    Offline

    actngrezy New Member Developer

    Joined:
    Mar 21, 2010
    Messages:
    1,074
    Likes Received:
    2
    Trophy Points:
    0
    Location:
    delaware
    So when pushing and pulling apps i dont have to mou.t the system as rw or do i still have to type all the other lines and just place ur commands in the place of my push pull commands or can i just type your commands and thats it?
  5. cupfulloflol
    Offline

    cupfulloflol New Member

    Joined:
    Dec 5, 2009
    Messages:
    1,898
    Likes Received:
    22
    Trophy Points:
    0
    Nope you shouldn't have to mount the system, I don't at least. Logically, I would think you would have to, so maybe my setup is special and I don't haha. But, I am going to say no you don't have to mount system prior to pushing.

    The first two commands should be all you need to do, in theory. The first command (adb pull...) pulls the file from your phone, and renames it on your PC in one command. You can change the filename to whatever you want, you don't have to use Phonebackup.apk Then the push command, to push the Phone.apk you want on your phone. When you do this, you may get some force closes. A restart (adb restart) should fix it, if not....check the permissions (last part of my previous post).

    If you want to play it safe, and make sure everything is right on the first pass:

    Code:
    adb shell
    su
    mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system
    exit
    adb pull /system/app/Phone.apk Phonebackup.apk
    adb push Phone.apk /system/app/
    adb shell
    su
    chmod 644 /system/app/Phone.apk
    sync
    mount -o remount,ro -t yaffs2 /dev/block/mtdblock4 /system
    reboot
    Mounts the system partition prior to pushing and pulling, then making sure the permissions on Phone.apk is correct. Also a sync and reboot. Most of this probably is fluff though, and not necessary.
  6. actngrezy
    Offline

    actngrezy New Member Developer

    Joined:
    Mar 21, 2010
    Messages:
    1,074
    Likes Received:
    2
    Trophy Points:
    0
    Location:
    delaware
    Thanks for your help. yeah i referenced my commands from adb guides and wasnt exactly sure plus it said do adb push then had phone.apk then system/app/phone.apk i wasnt really sure why the first phone.apk was in the comma d so some of the guides were confusing in that aspect and some had a little different ways like typing exit then exit again so i was a little unsure about it figured id better ask lol. thanks ahain when i get back to my comp this is first thing i will do.
    And what does sync do and how do you know when to use it. just teying to get more familiar with adb
  7. actngrezy
    Offline

    actngrezy New Member Developer

    Joined:
    Mar 21, 2010
    Messages:
    1,074
    Likes Received:
    2
    Trophy Points:
    0
    Location:
    delaware
    Thanks for your help. yeah i referenced my commands from adb guides and wasnt exactly sure plus it said do adb push then had phone.apk then system/app/phone.apk i wasnt really sure why the first phone.apk was in the comma d so some of the guides were confusing in that aspect and some had a little different ways like typing exit then exit again so i was a little unsure about it figured id better ask lol. thanks ahain when i get back to my comp this is first thing i will do.
    And what does sync do and how do you know when to use it. just teying to get more familiar with adb
  8. junpar
    Offline

    junpar New Member

    Joined:
    Mar 19, 2010
    Messages:
    187
    Likes Received:
    0
    Trophy Points:
    0
    If you're doing this to change the actual theme of the phone app you're doing it wrong. The Phone icon and layout is controlled by contacts.apk not phone.apk. Phone.apk controls the screen when you are in a call I believe.. I'm sorry if this is not why you are attempting this.
  9. cupfulloflol
    Offline

    cupfulloflol New Member

    Joined:
    Dec 5, 2009
    Messages:
    1,898
    Likes Received:
    22
    Trophy Points:
    0
    adb push and adb pull commands are a little different in how they are set up.

    adb push <local> <remote> . What that means is adb push <file on your PC, remember you are in the tools folder> <location on phone you want to send it>

    adb pull <remote> <local> . So the first part here "remote" is the phone file you are trying to pull. Meaning you have to put location and name of the file. The local part in this instance is the name of it once it is in your /tools/ directory.

    I am not sure why whomever would type exit twice. Typing it once in most cases should get you back to your OS's command prompt ( C:*location*/tools prompt) . If one doesn't get you there, go for it again. Just as a heads up typing exit into command prompt, it will close it if you type it too many times haha. Not that this is a big deal, you can just reopen cmd prompt.

    Sync, makes data get saved prior to an abrupt reboot. Since the phone isn't going to be shut down properly, things won't get saved. You are typing reboot in console which almost immediately kills the phone. A lot of scripts I have seen use it prior to a reboot. So, being that there are much smarter people than me writing these scripts so I have mimicked them. sync(8): synchronize data on disk with memory - Linux man page It may or may not be necessary, someone with a stronger linux background than myself may be able to answer this better.

    As always asking questions is in most cases better than just going in blind. Maybe someone can phrase some of the things I typed more eloquently. I am terrible at describing or teaching.

    Just for giggles, [TOOL] Android Commander 0.7.9 - New Design! - xda-developers <-- is a pretty cool tool. It can't do everything, well with the command prompt you can, but it makes pushing and pulling rather easy. Among some other things.