Decompile and recompile framework leads to bootloop - Galaxy Tab Q&A, Help & Troubleshooting

Hi all,
Trying to mod the framework for the first time.
I have no problem replacing the png. But when i try to modify the xml, i get bootloop.
I used the apk manager (4.9) to decompile the apk, then edit one xml before i recompile. I did notice that the recompiled apk is at least 2MB smaller than the original.
Am i missing a step here?
Sent from my GT-P1000 using XDA Premium App

Hi
yap ,,,the generated apk is unsigned...and no sign for system apk..so you have to copy by drag & drop the following files from the unsigned apk onto the original apk via WinRar and choosing ZIP archive format, NORMAL compression method.
- resources.arsc file
- res folder
- classes.dex file if exisit in the non-system apks
hope that help
good luck

Galaxyer said:
Hi
yap ,,,the generated apk is unsigned...and no sign for system apk..so you have to copy by drag & drop the following files from the unsigned apk onto the original apk via WinRar and choosing ZIP archive format, NORMAL compression method.
- resources.arsc file
- res folder
- classes.dex file if exisit in the non-system apks
hope that help
good luck
Click to expand...
Click to collapse
Ah,
I was thinking this as a possible workaround so it looks like it is thr solution?
Just a confirmation, if i change the battery_charging.xml, then i should compile, then extract out the battery_charging.xml from the recompiled framework-res.apk and insert into the original, signed framework-res.apk?
Sent from my GT-P1000 using XDA Premium App

I tried taking the compiled xml ( that defines the animation of battery charging icon on the status bar), put into the original framework-res.apk, and end up with non existent icon for the battery charging. Everything else remains working though.
What could have gone wrong?
Sent from my GT-P1000 using XDA Premium App

Related

Zipping apk's back up

So I figured out I can use root explorer to extract framework-res.apk to edit the eri.xml file to change my carrier name....what I don't know is how to put it all back together to replace the current apk ...
Any tips?
Sent from my HERO200 using XDA App
7 zip on the pc is the best way. Right click on the apk, and just open archive, and drag and drop files as necessary. No need to rezip
Sent from my HERO200 using XDA App
Thanks!
Sent from my HERO200 using XDA App
Vandelay007 said:
So I figured out I can use root explorer to extract framework-res.apk to edit the eri.xml file to change my carrier name....what I don't know is how to put it all back together to replace the current apk ...
Any tips?
Sent from my HERO200 using XDA App
Click to expand...
Click to collapse
you can unzip and rezip but its not needed, you can also decompile and recompile with apktools but that is might not be needed. If your just replacing a file all you need to do is open it in 7zip or winrar and drag it in to the appropriate folder it will replace the old file. You will need to resign it though.
My question is how are you editing the xml file are you decompiling it and then editing it? if so you need to recompile the apk before you copy it back in other wise you'll most likely get boot loops since android compiles their xmls to binary format.
Root explorer is the easiest way to edit xml's. You can read and edit binary xml's without any hex editors and crap. Much easier.
Sent from my HERO200 using XDA App
Yeah - that's what I thought too - however - there is no option on the eri.xml file to edit it when you long press on it - you can extract it - but it just moves it to sdcard/extracted - which is what brought me to wonder how i could zip it back up -
danaff37 said:
Root explorer is the easiest way to edit xml's. You can read and edit binary xml's without any hex editors and crap. Much easier.
Sent from my HERO200 using XDA App
Click to expand...
Click to collapse
Well technically you dont need to hex edit any of android xml's they just need to decompiled. They compile them to binary for speed and optomization purposes not like a java or c compilation where compile makes byte code.
Vandelay007 said:
Yeah - that's what I thought too - however - there is no option on the eri.xml file to edit it when you long press on it - you can extract it - but it just moves it to sdcard/extracted - which is what brought me to wonder how i could zip it back up -
Click to expand...
Click to collapse
So back to apk tool... use it to decompile the apk and edit your xml then recompile it. I don't use root explorer so there might be a way to use it to accomplish the same thing.

Need help with changing battery icons

Hey guyz. I have a Samsung Galaxy 5 (GT-i5503). I have installed froyo on it now from samfirmware.com. Right now I'm using a custom ROM from a guy named motafoca. I don't like the battery icons so I thought of changing it to the icons which indicated 1-100% and looked like the default one. So I pulled the framework-res.apk file from the framework directory and added the battery icons through 7zip. I also replaced the xml files in the drawable folder namely stat_sys_battery.xml, and two more files. After that the battery icon disappeared because I had the xml files from the battery mod. Figured out , it had got something to do with the xml file, I tried replacing the original files back but my phone got stuch in boot loop. So, I reflashed and its working now. After reading lot of information on this forum, I understood that we need to decompile the apk file so that we can edit the xml files. I did that and edited the xml files as necessary. Now, when I try to recompile the apk file with apk tool or apkmanager, I am getting an error saying the "Public symbol drawable/filename declared here is not defined" I am getting this error on many files including the ones that I have added. In one of the topics, somebody had suggested that we add the png files through 7zip without extracting the apk and then decompiling the apk so that the public.xml will autogenerate the ids for the new files, but that is not working. Can anyone help please? I am attaching the framework-res.apk file for reference.
Help!-
Sent from my GT-I5500L using XDA App
Bump!
Btw, did you ever get the answer?
Once you decompile the apk with apktool/apkmanager, and add your images and edited xml files, then you will need to delete res/values/public.xml; finally you can recompile the apk file and public.xml will be generated as it is building. Hope this helps.
I realize this is an old thread, but it appears the answer would still be appreciated.
I tried that, but it just gives me a bootloop.

framwork-res.apk modifying

Hi,
i'am searching for a guide how to manipulate correctly the framework-res.apk.
All ways i have tested fails.
I would modify some symbols in Notification bar (battery 1%) but all Time the my Phone run into bootloop or all Application Crashes after Startup.
I've tryed Apk Manager 4.9 / and Manualy with apktool.
Help plz .....
what i did :
1-extract apk (i use 7zip/WinRAR)
2-edit/replace image file(s)
3-repack with zero compression level ('store' level)
4-sign the apk
5-replace file using apk or create flashable recovery zip.
regards.
signing the framework-res.apk will not work.. will make the device go into bootloop
what you need is extract the framework-res.apk using apktool and edit the things you want and then compile it again using apktool .... now open the original framework-res.apk and replace the file resources.arsc with the edited compiled one..
this way you will retain the signature of the original framework-res.apk
PapaDocta said:
signing the framework-res.apk will not work.. will make the device go into bootloop
what you need is extract the framework-res.apk using apktool and edit the things you want and then compile it again using apktool .... now open the original framework-res.apk and replace the file resources.arsc with the edited compiled one..
this way you will retain the signature of the original framework-res.apk
Click to expand...
Click to collapse
But when i add some new Files and Edit some XML the Sign will be Corrupted ?
no it won't...
You need to do two copies.. the original file and the moded one...
1. make a backup of the original file
2. extract the original file using apktool
3. edit and modify anything you like
4. compile the edited file
5. rename the compiled file to framework-res.zip and take the modified resources.arsc
6. using winrar or 7zip open (to view not extract) the backed up framework-res.apk
7. place the moded resources.arsc into the backed up framework-res.apk
by doing this you retain the original signature of the backed up file and not breaking it..
Thx, will test it ;-)
kowalski99 said:
But when i add some new Files and Edit some XML the Sign will be Corrupted ?
Click to expand...
Click to collapse
Android system, signs system apk's on boot, you shouldnt sign them
Sent from my Desire HD using Tapatalk
My signed apk just work well.
AFAIK, we only cant re-sign htc's apk.
PapaDocta said:
signing the framework-res.apk will not work.. will make the device go into bootloop
what you need is extract the framework-res.apk using apktool and edit the things you want and then compile it again using apktool .... now open the original framework-res.apk and replace the file resources.arsc with the edited compiled one..
this way you will retain the signature of the original framework-res.apk
Click to expand...
Click to collapse
The right approach always depends, what you want to change. There is no need to decompile, if you only change a few standard png. If you change xml in values folder like color, styles or arrays, you can certainly not delete resources.arsc - resources have nothing to do with the signature anyway. So if you want to play safe, you should insert the original Meta-Inf (signature) and Android Manifest after compile. It is also recommended to zipalign the final apk in order to reduce RAM usage.
thanks he_stheone64 for the clarification.. i reached that conclusion based on my own research on the net and yeah i used to change the XML files to add language support and that the only way that worked with me..
And be sure to have a working and up-to-date sdk before trying to use apktool...
First, using a old sdk release i got a partially working result (few graphics bugs and strange reboots), then with a badly updated sdk on top off the old i got apktool making many errors. Finally, re-installing the last sdk from start i got apktool and my resulting apk working correctly.

[Q] aapt b framework-res.apk got bammi error

Hello All,
I would like to change the onscreen button dpi to get it small
I use apktool 1.5 and latest aapt which come from the android sdk
I can decompile the framwork-res.apk without any error "I use apktool if SemcGenericUxpRes.apk" already
but I got the error on compile "even I haven't modify any files" it's show aapt: warning: string 'BaMmi' has no default translitiration in"
I search from google and some of user got the same problem, however they haven't show any solution
Due to I see there have a user can modify the dpi, so that, would anyone let's me know how to fix this problem???
Many Thanks~~
PS: My firmware is 7.0.A.3.307 "Xperia TX"
That's not an error, that's a warning.
It basically means that a particular string doesn't exist in certain languages. Unless you're planning to set your phone to one of those languages, it's not an issue.
As long as that's the only complaint that's thrown up, you can safely ignore it and just carry on as usual.
Sent from my SK17i using xda premium
Ticklefish said:
That's not an error, that's a warning.
It basically means that a particular string doesn't exist in certain languages. Unless you're planning to set your phone to one of those languages, it's not an issue.
As long as that's the only complaint that's thrown up, you can safely ignore it and just carry on as usual.
Sent from my SK17i using xda premium
Click to expand...
Click to collapse
Thank you for your reply~~
But my phone got bootloop after replaced the framework-res.apk
And I found that, the compile framework-res on the root explorer is not show the icon of the original
it's show the Android icon
After that, I use FTF to reflash the firmware to recovery my phone = ="
Thanks~~
Did you sign the new apk and fix the compression rate before pushing it to your phone?
Sent from my SK17i using xda premium
Ticklefish said:
Did you sign the new apk and fix the compression rate before pushing it to your phone?
Sent from my SK17i using xda premium
Click to expand...
Click to collapse
Hello Ticklefish~~~
@[email protected]" you are so xxxx right~~ I'm stupid on forget to signature the apk
I have modified the apk since X10, it's long long ago..... so I forgot the step already = ="
I will try to search signapk, and see can I sign the apk = ="
Anyway,
Thank you so much~~~
PS: After I sign the apk, and put back to the phone = =" boot loop again
And I found that, the apk still haven't show the icon
I download the modified framework-res is around 16MB and my signed apk is around 15.4
org is 22MB, so I agree with your point is the, even the compile have a error, it should be work fine
but I don't know why I can't make a usable apk = ="
my signapk command is like this
java -jar signapk.jar certificate.pem key.pk8 framework-resnew.apk framework-resnewsigned.apk
And I found that the apk add around 4xxKB size, so that I think the apk is singed
Any idea???
Thank you so much~~
windmoon said:
Hello Ticklefish~~~
@[email protected]" you are so xxxx right~~ I'm stupid on forget to signature the apk
I have modified the apk since X10, it's long long ago..... so I forgot the step already = ="
I will try to search signapk, and see can I sign the apk = ="
Anyway,
Thank you so much~~~
PS: After I sign the apk, and put back to the phone = =" boot loop again
And I found that, the apk still haven't show the icon
I download the modified framework-res is around 16MB and my signed apk is around 15.4
org is 22MB, so I agree with your point is the, even the compile have a error, it should be work fine
but I don't know why I can't make a usable apk = ="
my signapk command is like this
java -jar signapk.jar certificate.pem key.pk8 framework-resnew.apk framework-resnewsigned.apk
And I found that the apk add around 4xxKB size, so that I think the apk is singed
Any idea???
Thank you so much~~
Click to expand...
Click to collapse
You do need to sign the apk...but you have to sign it in the same way as the original apk file. If the app is signed in a different way to the others in the system folder it won't work.
The best way to handle this is to use 7zip, which you can download for free. And then:
Make a copy of the original apk file
Use 7zip to open the copy and the recompiled apk
Drag the "res" folder from the recompiled apk into the copy
Close the copy
Extract "resources.arsc" from the recompiled apk
Close the recompiled apk
Use 7zip to add resources.arsc to the copy at STORE compression
Push the copy to your phone
This will ensure the copy has the right signing and that resources.arsc is at the right compression rate.
Not every apk has resources.arsc at store compression so that part isn't required all the time, but it doesn't cause any harm and it's good practise to get into.
Ticklefish said:
You do need to sign the apk...but you have to sign it in the same way as the original apk file. If the app is signed in a different way to the others in the system folder it won't work.
The best way to handle this is to use 7zip, which you can download for free. And then:
Make a copy of the original apk file
Use 7zip to open the copy and the recompiled apk
Drag the "res" folder from the recompiled apk into the copy
Close the copy
Extract "resources.arsc" from the recompiled apk
Close the recompiled apk
Use 7zip to add resources.arsc to the copy at STORE compression
Push the copy to your phone
This will ensure the copy has the right signing and that resources.arsc is at the right compression rate.
Not every apk has resources.arsc at store compression so that part isn't required all the time, but it doesn't cause any harm and it's good practise to get into.
Click to expand...
Click to collapse
@[email protected]" Many Thanks~~~
Study a lot from you~~~
Thank you~
I will try this later~~~

[MOD] Multi DPI Camera and Samsung Keyboard

Decided to start a new thread as this one was getting a bit messy (and I couldn't change the title anymore)
http://forum.xda-developers.com/galaxy-s6/themes-apps/mod-multi-dpi-samsung-apps-camera-t3141148
----------------------------------------------------------
Hi all, after changing the dpi to 480 the camera was the main thing bugging me. Looking for a solution I found this thread:
http://forum.xda-developers.com/galaxy-s6/themes-apps/mod-fix-samsung-camera-app-device-dpi-t3131995
But that did not work for me, so I decided to try it myself and I finally managed to create multi-dpi versions of the Camera and Samsung Keyboard apps. They are based on the apks from the XtreStoLite Universal Deo-Mod Edition 1.5 as I'm currently running that. So just give it a try (backup the original apks first! I usually just rename them to "filename.org") and let me know if it works for you. I tested on 480 and 520 dpi and that works here...
Installation:
1. Backup original apk (in system\app\SamsungCamera4 and/or systemm\app\SamsungIMEv2 )
2. Extract modded apk to the corresponding folder
3. Wipe data for the app
4. Reboot
I basically modified the dimens.xml file to hardcoded pixel sizes instead of dip value, modifying dip value caused other issues for me (camcorder not working, pro mode messing up). Hopefully it's of use to some.
I have not been able to fix the Contacts/Dialer (SecContacts_L.apk in the priv-app folder)! I either get a corrupt apk (parsing error) or it just won't show up in my apps. Corrupted apk gives a parsing error when trying to install manually, otherwise it just says 'install failed'.
I am guessing this is somethiong with the priv-app folder and other restrictions there. I also tried copying the apk to the system\app folder instead but that didn't work either...
If anyone has ANY idea how to fix this? (I tried with both apktool as apk multitool).
*SCRIPTS ADDED*
Added the scripts and all I've written for this to this post for those wanting to try themselves (dpi_mod.zip). They are not completely polished so need some manual editing every now and then...
Basically, doubleclicking apk_process.bat in the root will go through the apk's in the apk subfolder and
1. Decompile them to the decompiled subfolder
2. Edit the dimens.xml file in the res\values subfolder of the decompiled folder replacing all the <n>dip values with <4*n>px (So 640 dip becomes 2560px for example...)
3. Rebuild the apk to the dpimod_apk subfolder (using the -c option to keep original manifest and signature files)
The files folder contains the files used (apktool, the subscripts for each step, signature files, (g)awk and an awk script to process the xml file replacing the values, etc)
There is also a script for signing the apk manually, but somehow the apk then also doesn;t work in my case it seems...
ALl scripts are windows batch files (and an awk file) as I mainly use windows at home. Shouldn't be too hard for the linux users to convert them to bash files if desired...
*EDIT2*
Added patched services.jar (and original services.jar for restoration in case of issues). Flash through twrp recovery... This allows you to use the modded SecContacts_L.apk supplied, the services.jar needs to be patched to disable the signature verification for the (system) apk files. Note that this might cause issues (an invalid services.jar caused my phone to get stuck in boot... had to restore the original to be able to continue) so use at your own risk!
Great job !
I have not been able to decompile the contacts.apk either.. I am a bit rusty tho.. will have to look into that a little more.
fOmey said:
Great job !
I have not been able to decompile the contacts.apk either.. I am a bit rusty tho.. will have to look into that a little more.
Click to expand...
Click to collapse
Thanks! And yeah, weird stuff.
I actually was only really bothered by the camera, not using the samsung keyboard at all myself and don't mind the contacts as much (perfectly usable for me) but it's now a matter of principle If you find anything out, I would love to hear.
dagrim1 said:
Thanks! And yeah, weird stuff.
I actually was only really bothered by the camera, not using the samsung keyboard at all myself and don't mind the contacts as much (perfectly usable for me) but it's now a matter of principle If you find anything out, I would love to hear.
Click to expand...
Click to collapse
But In Call screen looks weird with 480 DPI right? Would you know any fix for that? Thanks.
Sent from my SM-G925F using XDA Free mobile app
ksekhar said:
But In Call screen looks weird with 480 DPI right? Would you know any fix for that? Thanks.
Sent from my SM-G925F using XDA Free mobile app
Click to expand...
Click to collapse
Yup, it does. (But again, doesn't bother me as much as I don't look at it long because I usually hold my phone to my ear anyway ).
But yeah, I think I know where to fix it... It's the Contacts apk I mentioned above but there is an issue with decompiling/rebuilding it so can't fix it yet. Looking into it.
Did notice when decompiling and recompiling including resources it fails, when keeping resources intact it does work.
To successfully mod seccontacts you have to do these steps :
- Decompile apk
- Edit xml files in res folder
- Recompile apk
- Extract xml edited files in res folder from recompiled apk
- Paste these xml files in the original apk in the res folder with compression tool like Winrar
It works I made this with my S5.
Meh, been looking into it some more and also found this:
http://forum.xda-developers.com/android/software-hacking/how-to-recompile-tw-contacts-phone-t3066350
and
http://www.ez-pg.com/guide-how-to-decompilerecompile-lollipop-seccontacts.html
I tried modifying the manifest as instructed, but the apk still didn't work. Perhaps because signature verfication is not properly disabled on my rom. BUt if it isn't it is also not for the majority of the users in which case siumply supplying the apk wouldn't work anyway.
I also tried resigning the apk, no luck. Copying the original manifast is also not going to work afaik with a changed manifest file...
More info about signature verficiation:
http://forum.xda-developers.com/showthread.php?t=2725233
http://forum.xda-developers.com/showthread.php?t=2342262
Perhaps I will try this soon as well, but for now I think I'll leave it be...
sebdigital said:
To successfully mod seccontacts you have to do these steps :
- Decompile apk
- Edit xml files in res folder
- Recompile apk
- Extract xml edited files in res folder from recompiled apk
- Paste these xml files in the original apk in the res folder with compression tool like Winrar
It works I made this with my S5.
Click to expand...
Click to collapse
Thanks for the tip, had looked into that as well but this xml file is in the values folder which is not simply found in the res folder of the apk but compiled into the resources.arsc file in the apk so this is not working unfortunately.
dagrim1 said:
Thanks for the tip, had looked into that as well but this xml file is in the values folder which is not simply found in the res folder of the apk but compiled into the resources.arsc file in the apk so this is not working unfortunately.
Click to expand...
Click to collapse
I'm on 5.1.1 today and noticed that contacts/dialer is (almost) multi DPI already without having to do anything. And your camera mod works on 5.1.1 too!
Sent from my SM-G920F using XDA Free mobile app
can u change this Camera 480 dpi camera s6 to 420 dpi?
https://mega.nz/#!M4Ui0KoR!TKsPKkMl-XQHyiJ_DNf53eQCGZTrYWhuHaAnhAYXeSM
thanks you very much
can be used for other than s6 for SamsungCamera4. ??
my android device A8 6
dagrim1 said:
Decided to start a new thread as this one was getting a bit messy (and I couldn't change the title anymore)
http://forum.xda-developers.com/galaxy-s6/themes-apps/mod-multi-dpi-samsung-apps-camera-t3141148
----------------------------------------------------------
Hi all, after changing the dpi to 480 the camera was the main thing bugging me. Looking for a solution I found this thread:
http://forum.xda-developers.com/galaxy-s6/themes-apps/mod-fix-samsung-camera-app-device-dpi-t3131995
But that did not work for me, so I decided to try it myself and I finally managed to create multi-dpi versions of the Camera and Samsung Keyboard apps. They are based on the apks from the XtreStoLite Universal Deo-Mod Edition 1.5 as I'm currently running that. So just give it a try (backup the original apks first! I usually just rename them to "filename.org") and let me know if it works for you. I tested on 480 and 520 dpi and that works here...
Installation:
1. Backup original apk (in system\app\SamsungCamera4 and/or systemm\app\SamsungIMEv2 )
2. Extract modded apk to the corresponding folder
3. Wipe data for the app
4. Reboot
I basically modified the dimens.xml file to hardcoded pixel sizes instead of dip value, modifying dip value caused other issues for me (camcorder not working, pro mode messing up). Hopefully it's of use to some.
I have not been able to fix the Contacts/Dialer (SecContacts_L.apk in the priv-app folder)! I either get a corrupt apk (parsing error) or it just won't show up in my apps. Corrupted apk gives a parsing error when trying to install manually, otherwise it just says 'install failed'.
I am guessing this is somethiong with the priv-app folder and other restrictions there. I also tried copying the apk to the system\app folder instead but that didn't work either...
If anyone has ANY idea how to fix this? (I tried with both apktool as apk multitool).
*SCRIPTS ADDED*
Added the scripts and all I've written for this to this post for those wanting to try themselves (dpi_mod.zip). They are not completely polished so need some manual editing every now and then...
Basically, doubleclicking apk_process.bat in the root will go through the apk's in the apk subfolder and
1. Decompile them to the decompiled subfolder
2. Edit the dimens.xml file in the res\values subfolder of the decompiled folder replacing all the <n>dip values with <4*n>px (So 640 dip becomes 2560px for example...)
3. Rebuild the apk to the dpimod_apk subfolder (using the -c option to keep original manifest and signature files)
The files folder contains the files used (apktool, the subscripts for each step, signature files, (g)awk and an awk script to process the xml file replacing the values, etc)
There is also a script for signing the apk manually, but somehow the apk then also doesn;t work in my case it seems...
ALl scripts are windows batch files (and an awk file) as I mainly use windows at home. Shouldn't be too hard for the linux users to convert them to bash files if desired...
*EDIT2*
Added patched services.jar (and original services.jar for restoration in case of issues). Flash through twrp recovery... This allows you to use the modded SecContacts_L.apk supplied, the services.jar needs to be patched to disable the signature verification for the (system) apk files. Note that this might cause issues (an invalid services.jar caused my phone to get stuck in boot... had to restore the original to be able to continue) so use at your own risk!
Click to expand...
Click to collapse
how to fix on parse error, after recompile SamsungCamera4.apk with apktool
with or without edit error on parse...
My device Galaxy-A8

Categories

Resources