[Q]Apktool framework-res.apk - Xperia Z1 Q&A, Help & Troubleshooting

I have a C6943 and i want to change led notification frequency by changing the values in res/values/integer.xml in framework-res.apk.
But when i try to decompile framework with apktool (via pc, or via the phone app) i got a lot of errors like this:
Could not decode attr value, using undecoded value instead:ns=
I already installed the framework and in the apktool app i already set the apktool folder. Don't know what to do..
I can decompile other .apk just got this error in framework

ffp. said:
I have a C6943 and i want to change led notification frequency by changing the values in res/values/integer.xml in framework-res.apk.
But when i try to decompile framework with apktool (via pc, or via the phone app) i got a lot of errors like this:
Could not decode attr value, using undecoded value instead:ns=
I already installed the framework and in the apktool app i already set the apktool folder. Don't know what to do..
I can decompile other .apk just got this error in framework
Click to expand...
Click to collapse
Try with older framework (installed on PC) and install semcgeneric apk to PC as well.
So, install 4.2.2 framework and semcgeneric on PC and try to decompile 4.3 framework.
Sent from my C6903 using Tapatalk

I managed to decompile installing semc apk but now i can't recompile it. I'm getting W:aapt location could not be found and a lot more errors. I'm using apktool v4.4 app. Doing everything from phone

ffp. said:
I managed to decompile installing semc apk but now i can't recompile it. I'm getting W:aapt location could not be found and a lot more errors. I'm using apktool v4.4 app. Doing everything from phone
Click to expand...
Click to collapse
What do you mean - " Doing everything from phone"?
Sent from my C6903 using Tapatalk

I mean that i'm using this app here:
http://forum.xda-developers.com/showthread.php?t=2359240

I managed to decompile and recompile it with success, but i got bootloops even if i didn't changed anything. Already tried signing. What should i do?

ffp. said:
I managed to decompile and recompile it with success, but i got bootloops even if i didn't changed anything. Already tried signing. What should i do?
Click to expand...
Click to collapse
As I can see it needs busybox to be updated and we have informations not to update busybox because we could end up in bootloop or to lose root...
That's why I don't use ninjaMorph or this (great apps but for 535 or 257 firmware)
Sent from my C6903 using Tapatalk

Related

Decompiling 2.2 files

Hello,
I am trying to edit settings.apk and some of the library files such as libskia.so for the new firmware in order to localize them. apktool isn't succeeding decoding the settings.apk file for 2.2 even though it was fine with 2.1 firmware. Does anyone know how I can decode the 2.2 files by using windows or cygwin? Thanks...
Do you have add Froyo's framework-res to the apktool?
apktools if system/framework/framework-res.apk
Click to expand...
Click to collapse
Ask again here ==> forum.xda-developers.com/forumdisplay.php?f=565
or here ==> forum.xda-developers.com/forumdisplay.php?f=456
supirman said:
Do you have add Froyo's framework-res to the apktool?
Click to expand...
Click to collapse
I did that but I still get errors such as:
Code:
W: Could not decode attr value, using undecoded value instead: ns=android, name=
textColorHint, value=0x02050001
Can't find framework resources for package of id: 2. You must install proper fra
mework files, see project website for more info.
Here is another question, how can I find samsung galaxy s 2.2 resources? I believe that's what I am missing to get it working. I think it might be a file like this com.samsung.resources.apk or similar.
EDIT: I managed to decode settings.apk successfully by adding twframework-res.apk to apktool. Now I just need to figure out how to edit libskia.so for 2.2.
Powerhuman said:
I did that but I still get errors such as:
Code:
W: Could not decode attr value, using undecoded value instead: ns=android, name=
textColorHint, value=0x02050001
Can't find framework resources for package of id: 2. You must install proper fra
mework files, see project website for more info.
Here is another question, how can I find samsung galaxy s 2.2 resources? I believe that's what I am missing to get it working. I think it might be a file like this com.samsung.resources.apk or similar.
EDIT: I managed to decode settings.apk successfully by adding twframework-res.apk to apktool. Now I just need to figure out how to edit libskia.so for 2.2.
Click to expand...
Click to collapse
Have you edited it in firmware 2.1?
Powerhuman said:
Now I just need to figure out how to edit libskia.so for 2.2.
Click to expand...
Click to collapse
Nearly impossible: it's native code, you know. Even worst: ARMs aren't so popular as PC, so there aren't too many ARM disassemblers/decompilers for them.
But I think it's just a image processing library, so... what to localize in it?
zygame said:
Have you edited it in firmware 2.1?
Click to expand...
Click to collapse
it has been done using linux. however, I am trying to use cygwin to do it but I can't seem to have the dpkg command installed in cygwin.
Brut.all said:
Nearly impossible: it's native code, you know. Even worst: ARMs aren't so popular as PC, so there aren't too many ARM disassemblers/decompilers for them.
But I think it's just a image processing library, so... what to localize in it?
Click to expand...
Click to collapse
I am trying to add another language to 2.2. We managed to add it to 2.1 but 2.2 seems to use different encryption method which we haven't managed to successfully decode.
Powerhuman said:
I am trying to add another language to 2.2. We managed to add it to 2.1 but 2.2 seems to use different encryption method which we haven't managed to successfully decode.
Click to expand...
Click to collapse
Encryption? It's a library file, like .dll on Windows. It's not encrypted, it's just compiled, like any .dll, .exe, etc. on your PC.
Did you succeed in "decrypting" libskia.so from 2.1?
Brut.all said:
Encryption? It's a library file, like .dll on Windows. It's not encrypted, it's just compiled, like any .dll, .exe, etc. on your PC.
Did you succeed in "decrypting" libskia.so from 2.1?
Click to expand...
Click to collapse
Encryption might not be the correct word. When you "compile" these files, sometimes there are headers associated with them, without them, it would be very difficult to "decompile" them in order to edit it.
Powerhuman said:
Encryption might not be the correct word. When you "compile" these files, sometimes there are headers associated with them, without them, it would be very difficult to "decompile" them in order to edit it.
Click to expand...
Click to collapse
Ok, but Skia is an open source project, it's a part of AOSP Of course Samsung may modified something in it, but I doubt it.
EDIT:
And still it's illogical to me, that there is something to localize in image processing library.
Brut.all said:
Ok, but Skia is an open source project, it's a part of AOSP Of course Samsung may modified something in it, but I doubt it.
EDIT:
And still it's illogical to me, that there is something to localize in image processing library.
Click to expand...
Click to collapse
I am trying to localize it to arabic, if you know the language you would know that its letters are connected in certain situations. Currently, these files do not connect them correctly and even more, it inverts the letter positions. In order to fix this issue, these library files have to be modified. This has been done in 2.1 and I heard someone did it for Nexus1 2.2. We are trying to get a hold of him to understand how did he modify them in 2.2.
Here is something i just noticed.
Even though I have successfully decoded and built Settings.apk using pktool. I have notice a difference in the size of the file (the newer file is much smaller). So I tried to decode and build the same exact file without any modifications and it still does the same thing (original Settings.apk is 3.4MB while the rebuilt unmodified file is 2.1MB)
Using winrar to check the new file I have noticed missing files namely the META-INF folder. Is this normal with apktool?
I used the following to decode and build the file
> apktool d settings.apk
> apktool b settings settings.apk
There are no errors in decoding or building the file.
EDIT: Nevermind, I forgot to sign the file which corresponds to the same missing files.
Powerhuman said:
Here is something i just noticed.
Even though I have successfully decoded and built Settings.apk using pktool. I have notice a difference in the size of the file (the newer file is much smaller). So I tried to decode and build the same exact file without any modifications and it still does the same thing (original Settings.apk is 3.4MB while the rebuilt unmodified file is 2.1MB)
Using winrar to check the new file I have noticed missing files namely the META-INF folder. Is this normal with apktool?
I used the following to decode and build the file
> apktool d settings.apk
> apktool b settings settings.apk
There are no errors in decoding or building the file.
EDIT: Nevermind, I forgot to sign the file which corresponds to the same missing files.
Click to expand...
Click to collapse
Ye,you have to sign the file by yourself,and with samsung's private key to works with other samsung's files
Powerhuman said:
I did that but I still get errors such as:
Code:
W: Could not decode attr value, using undecoded value instead: ns=android, name=
textColorHint, value=0x02050001
Can't find framework resources for package of id: 2. You must install proper fra
mework files, see project website for more info.
Here is another question, how can I find samsung galaxy s 2.2 resources? I believe that's what I am missing to get it working. I think it might be a file like this com.samsung.resources.apk or similar.
EDIT: I managed to decode settings.apk successfully by adding twframework-res.apk to apktool. Now I just need to figure out how to edit libskia.so for 2.2.
Click to expand...
Click to collapse
if ur using mediatek then
use
apktool if mediatek-res.apk

[Q] How to edit framework-res.apk?

I'm trying to edit framework-res.apk so I can theme my rom. Are these the correct steps?
pull framework-res.apk from my phone
decompile the apk
make the changes
rebuild the apk
sign
zipalign
push apk back to device
I'm not too sure on this method as after I pushed back my modified apk, I get a load of force close errors
Any advice would be welcome
don't sign and don't zipalign and all are fine
I tried without sign and zipalign but the rom wouldnt boot. If I sign, I get force close errors
Does the rom need to be deoxed?
How is your process to decompile and recompile what tools do you use
vibez said:
I tried without sign and zipalign but the rom wouldnt boot. If I sign, I get force close errors
Does the rom need to be deoxed?
Click to expand...
Click to collapse
Sent from my GT-I9000 using XDA App
Is this an ODEXed ROM or a deOXEDed ROM? You can't mix and match. If you're not ODEXing any APKs after you've modified them then you need to make sure all APKs are deOXEDed.
setenza01 said:
How is your process to decompile and recompile what tools do you use
Sent from my GT-I9000 using XDA App
Click to expand...
Click to collapse
I use apk manager to decompile and rebuild
Benjamin Dobell said:
Is this an ODEXed ROM or a deOXEDed ROM? You can't mix and match. If you're not ODEXing any APKs after you've modified them then you need to make sure all APKs are deOXEDed.
Click to expand...
Click to collapse
It is a stock rom but there is no framework-res.odex does that mean it doesn't need deodexing even though there are odex files for every other apk in my system folder?
maybe this little monster is some help to you:
http://forum.xda-developers.com/showthread.php?p=7377678#post7377678
FadeFx said:
maybe this little monster is some help to you:
http://forum.xda-developers.com/showthread.php?p=7377678#post7377678
Click to expand...
Click to collapse
Nice app but this theme also needs .xml changes which this app doesnt support
ok, i put him a note in his thread about the xml changing issue, we will see what hes answer will be...
edit:
also this software could do the trick: http://android.modaco.com/content/t-mobile-pulse-pulse-modaco-com/302404/ande-android-design-editor/
I've been playing around a little more today and it seems the issue is that no tool can rebuild the xml files correctly, they seem to be compressed/encoded.
Has anyone been able to edit an xml file in framework-res.apk and have the phone read it properly?
vibez said:
I've been playing around a little more today and it seems the issue is that no tool can rebuild the xml files correctly, they seem to be compressed/encoded.
Has anyone been able to edit an xml file in framework-res.apk and have the phone read it properly?
Click to expand...
Click to collapse
Refer to my signature. Apk manager.
Edit : just read ur op.
Never sign the system apk's. Simply keep the original signatures intact and after recompiling them, re-include them.
So here are the rules u must follow :
If u've modified the manifest.xml, u must stop core, push the apk, start core or push the apk while in recovery.
If u've modified anything else, a simple push / reboot will do the trick.
Note, u cannot flash a modified system apk the first time (as in on a clean boot), u must flash the original rom, let it build the dex's and then flash ur modified apk.
Daneshm90 said:
Refer to my signature. Apk manager.
Edit : just read ur op.
Never sign the system apk's. Simply keep the original signatures intact and after recompiling them, re-include them.
Click to expand...
Click to collapse
Hi, I am already using apk manager but the xml files it creates do not seem to work.
To prove this, I have done a test. See the attached xml files,
original_stat_sys_battery.xml was extracted from the original framework-res.apk
I then used apk manager to decompile and then recompile the same apk without making any changes.
recompiled_stat_sys_battery.xml is this recompiled file
I then opened up both files and they look different to me
vibez said:
Hi, I am already using apk manager but the xml files it creates do not seem to work.
To prove this, I have done a test. See the attached xml files,
original_stat_sys_battery.xml was extracted from the original framework-res.apk
I then used apk manager to decompile and then recompile the same apk without making any changes.
recompiled_stat_sys_battery.xml is this recompiled file
I then opened up both files and they look different to me
Click to expand...
Click to collapse
That shouldn't concern u. Apktool's method of rebuilding the apk/arsc file is slightly different than how android originally builds an apk. What should concern u is if the apk simply works. Now when u decompile the apk, can u check the log to see if it reports of any missing resources, if it doesn't ur fine. So decompile the apk, make ur changes, recompile the apk, move the original meta-inf folder into ur new apk and push it to ur phone following the guidelines in my previous post. if it causes problems, post ur log and i'll take a look.
Ok this time I have added meta-inf to the new apk, pushed it to my phone and the phone hangs on boot.
Here is my log
--------------------------------------------------------------------------
|08/08/2010 -- 18:36:30.87|
--------------------------------------------------------------------------
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the path specified.
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)
'adb' is not recognized as an internal or external command,
operable program or batch file.
Could Not Find C:\Documents and Settings\Lee\Desktop\Apk_Manager_4.8\place-apk-here-for-modding\../place-apk-here-for-modding/repackaged.apk
Could Not Find C:\Documents and Settings\Lee\Desktop\Apk_Manager_4.8\place-apk-here-for-modding\../place-apk-here-for-modding/repackaged-signed.apk
Could Not Find C:\Documents and Settings\Lee\Desktop\Apk_Manager_4.8\place-apk-here-for-modding\../place-apk-here-for-modding/repackaged-unsigned.apk
The system cannot find the file specified.
I: Loading resource table...
I: Decoding resources...
I: Copying assets and libs...
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
aapt: warning: string 'keyguard_password_attempts_count_pin_code' has no default translation in C:\Documents and Settings\Lee\Desktop\Apk_Manager_4.8\other\..\out\res; found: fr ko
I: Building apk file...
Click to expand...
Click to collapse
Oh lol i meant the log of ur phone.
Use adb logcat
lol ok, at which point should I run logcat - after the hang or as soon as I switch the phone on?
vibez said:
lol ok, at which point should I run logcat - after the hang or as soon as I switch the phone on?
Click to expand...
Click to collapse
When u switch phone On.
Ok here you are
vibez said:
Ok here you are
Click to expand...
Click to collapse
Heres ur culprit
Code:
java.lang.SecurityException: META-INF/MANIFEST.MF has invalid digest for AndroidManifest.xml
Now seems u modified the androidmanifest.xml ? If u didn't then heres my recommendation, copy over the original androidmanifest.xml from the original apk.

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.

Decompile and recompile framework leads to bootloop

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

[Q] Editing framework-res.apk

Hey can someone give me some quick tips on how to edit it?
I edited SystemUI.apk just fine but no matter what I do to framework-res, it won't let me replace the files (I'm only replacing pngs in drawable-mdpi folder)
What error are you getting? Also, install framework with apktool
POTATO!!!!
I think he's talking about drag and drop png file ) If it's true, the solution for him is learning how to decompile apk. Becoz most of png in systemUI is png, not too many 9.png files so it's easy to replace without decompiling
devilsking said:
I think he's talking about drag and drop png file ) If it's true, the solution for him is learning how to decompile apk. Becoz most of png in systemUI is png, not too many 9.png files so it's easy to replace without decompiling
Click to expand...
Click to collapse
Yup...
Decompile the framework-res.apk with Apktool and then replace the pngs..
I can't recompile because apktool always crashes when trying to recompile XML files. I'm using the AceCream framework apk instead of the stock rom one...
I'll try this on another PC to see if it's some weird software glitch
ZakooZ said:
I can't recompile because apktool always crashes when trying to recompile XML files. I'm using the AceCream framework apk instead of the stock rom one...
I'll try this on another PC to see if it's some weird software glitch
Click to expand...
Click to collapse
Try APK manager...much easier...
ZakooZ said:
I can't recompile because apktool always crashes when trying to recompile XML files. I'm using the AceCream framework apk instead of the stock rom one...
I'll try this on another PC to see if it's some weird software glitch
Click to expand...
Click to collapse
Tell me the definition of your "crashes"
it will show errors if u did smth wrong, even u use apkmanager )
For me apktool is more easier
devilsking said:
Tell me the definition of your "crashes"
it will show errors if u did smth wrong, even u use apkmanager )
For me apktool is more easier
Click to expand...
Click to collapse
Well, apktool dumps a stack trace where the error seems to occur in a public.xml file, apk manager says there is a error but the log shows nothing for me
https://www.dropbox.com/s/hbgqlo8pkfff10p/framework-res.apk
Can you test if you can modify this file without errors?
ZakooZ said:
Well, apktool dumps a stack trace where the error seems to occur in a public.xml file, apk manager says there is a error but the log shows nothing for me
https://www.dropbox.com/s/hbgqlo8pkfff10p/framework-res.apk
Can you test if you can modify this file without errors?
Click to expand...
Click to collapse
Oh...The infamous apktool bug...Use another version of apk tool and compile,will work
POTATO!!!!

Categories

Resources