Hello there
Trying to make some modifications to SystemUI.apk.
When trying to recompile the SystemUI.apk I got some error, which is this:
http://pastebin.com/qLBsLdDB
"D:\Apk_Manager_ICS\other\..\projects\SystemUI.apk\res\layout\status_bar.xml:30: error: Error parsing XML: mismatched tag"
Thats the first error line I read, and that's where I made changes, So I figured there must be something wrong in the code.. so I edit status_bar.xml and check it for xml errors and this is what comes up:
"XML parsing error at line 30:
Premature end of data tag
com.android.systemui.statusbar.phone.PhoneStatusBarView line2"
So I guess that means there's something wrong at line 30, But I can't seem the find out what's wrong.
So I'm asking, any theming expert can see whats wrong here:
http://pastebin.com/bWDhSsSz
Hope anyone can help me figure out what's wrong here
Thanks in advance!
Its either the fact that you're editing the XML in Notepad or your apktool.jar doesn't compile the latest ICS systemUI's. I've had this issue with decompiling before and I had to find an old apktool.jar that I themed back in the SGS2 days and it worked with 0 issues.
Also, have you just tried straight decompiling and compiling to confirm its an issue with the apktool.jar? If you do get the error without making changes, theres your issues.
If you don't, download Notepad++ and try again.
Nitroz said:
Its either the fact that you're editing the XML in Notepad or your apktool.jar doesn't compile the latest ICS systemUI's. I've had this issue with decompiling before and I had to find an old apktool.jar that I themed back in the SGS2 days and it worked with 0 issues.
Also, have you just tried straight decompiling and compiling to confirm its an issue with the apktool.jar? If you do get the error without making changes, theres your issues.
If you don't, download Notepad++ and try again.
Click to expand...
Click to collapse
Alright, thanks for your reply, ill try it when I get home in a few hours. What about the XML error I'm getting? I am using Notepad++ and when I check for XML errors there, it gives me the error @ line 30. Any idea?
nerotix said:
Alright, thanks for your reply, ill try it when I get home in a few hours. What about the XML error I'm getting? I am using Notepad++ and when I check for XML errors there, it gives me the error @ line 30. Any idea?
Click to expand...
Click to collapse
It depends what you're doing. If you've changed a line of code that you shouldn't then it will error like theres no tomorrow. We need to decipher if this is the issue yet, it might not be.
Nitroz said:
It depends what you're doing. If you've changed a line of code that you shouldn't then it will error like theres no tomorrow. We need to decipher if this is the issue yet, it might not be.
Click to expand...
Click to collapse
Alright, ill let u know =)
P.S Could u perhaps give me ur tools? APKManager and/or Apktools etc, the things u use.
Ok, I did it remotely from college, I decompiled the SystemUI.apk and compiled directly again, worked fine. So I guess next is the XML?
Thanks for helping!
Yep, just decompile once more, edit a simple XML like the status_bar.xml and change a hex code, like an ICS Blue hex code or something like that
Nitroz said:
Yep, just decompile once more, edit a simple XML like the status_bar.xml and change a hex code, like an ICS Blue hex code or something like that
Click to expand...
Click to collapse
I changed a hex for res\values\colors.xml and compiled it, worked fine.
nerotix said:
Hello there
Trying to make some modifications to SystemUI.apk.
When trying to recompile the SystemUI.apk I got some error, which is this:
http://pastebin.com/qLBsLdDB
"D:\Apk_Manager_ICS\other\..\projects\SystemUI.apk\res\layout\status_bar.xml:30: error: Error parsing XML: mismatched tag"
Thats the first error line I read, and that's where I made changes, So I figured there must be something wrong in the code.. so I edit status_bar.xml and check it for xml errors and this is what comes up:
"XML parsing error at line 30:
Premature end of data tag
com.android.systemui.statusbar.phone.PhoneStatusBarView line2"
So I guess that means there's something wrong at line 30, But I can't seem the find out what's wrong.
So I'm asking, any theming expert can see whats wrong here:
http://pastebin.com/bWDhSsSz
Hope anyone can help me figure out what's wrong here
Thanks in advance!
Click to expand...
Click to collapse
Hi
a closing tag is missing in your file a "</LinearLayout>" is missing ,
add </LinearLayout> at line 30
el_liberator said:
Hi
a closing tag is missing in your file a "</LinearLayout>" is missing ,
add </LinearLayout> at line 30
Click to expand...
Click to collapse
Added, rechecked with N+++ for errors and there's none! Thanks a ton! gonna try to compile right away!
el_liberator said:
Hi
a closing tag is missing in your file a "</LinearLayout>" is missing ,
add </LinearLayout> at line 30
Click to expand...
Click to collapse
Does it matter where I put that closing tag? I mean if I place it @ line 30, wouldnt it matter if its suppose to be closed earlier one?
Related
Source Found
Brut.all of XDA has released the program APKtool which make the process of editing any APK file much easier, especially XML editing. Before you had to use a few different programs (Smali, hex editor, etc) to do the same thing. A future release is going to have the decompiler dump into an easy to import into Javabeans/Eclipse format.. so nice
Program and Usage link;
APKTool 1.2
Setup;
Before you start, download from the link above both the apktool-1.2.0.tar.bz2 and apktool-install-windows-2.2_r01-1.tar.bz2 and extract them to your windows folder.
Usage;
Decoding APKs;
Code:
apktool d <file.apk> <directory to output to>
Compiling APKs*;
Code:
apktool b <directory of decoded apk>
*The compiled apk will be saved to the sub directory "dist", which is in what ever directory you choose to compile.
Output structure;
Smali directory - The output of classes.dex, the code to the apk
Res directory - Your resources, the images and layout/structure xmls
Lib directory - Shared library files
Dist directory - The apk output of the "apktool b" command, if you didn't run it you won't have it.
Build directory - The compiled output of the "apktool b" command, like what you would see if you just extracted an apk file with 7zip. If you didn't run it you won't have it.
General info;
Once you have your edited apk from the Dist directory you'll need to sign it. I use Dave Da illest 1 of XDA's modified script for signing. Just place your apk, this should be the only apk in this folder, in the same folder that you extracted the auto-signer to and execute sign.bat. The script will output your_app_signed.apk, which is your signed and ready to load on your phone apk.
If you'd like to decompile/compile an apk file that doesn't have a classes.dex, like framework-res.apk, just place any classes.dex into the apk and it will decompile. If you don't do this apktool will through up an error. Just remember to pull the classes.dex out before you sign it.
Videos;
Editing an Apk file with APKTool;
http://www.youtube.com/watch?v=XXgYVHTcl6c
Editing a Jar file with APKtool;
http://www.youtube.com/watch?v=VAekeWiqHcY
Why?;
Localization / Translation
Themeing
Adding in features or taking them out
Impressing friends and family, lol
etc..
Issues;
I noticed that while the new version 1.2 works great on the framework-res.apk file, it seems to have issues with other System/app files like Settings.apk,Phone.apk, etc. For these files use version 1.1.1.
Hopefully this is helpful, I tend to ramble.
-Ften @ sdx-developers.com
http://forum.xda-developers.com/forumdisplay.php?f=613
Post it here too, mate.
shokkapic said:
http://forum.xda-developers.com/forumdisplay.php?f=613
Post it here too, mate.
Click to expand...
Click to collapse
Will do, not having a good time at the moment as I can't seem to edit launcher.apk with this tool. Not sure why. basically I decompile, edit then compile but having issues when transferring it back to the phone.
EDIT: I just get a black screen when trying the new modified .apk file.
Why to create new threads, if apktool has its official thread here
http://forum.xda-developers.com/showthread.php?t=640592
andrewb84uk said:
Will do, not having a good time at the moment as I can't seem to edit launcher.apk with this tool. Not sure why. basically I decompile, edit then compile but having issues when transferring it back to the phone.
EDIT: I just get a black screen when trying the new modified .apk file.
Click to expand...
Click to collapse
Do you get any errors in logcat?
Brut.all said:
Why to create new threads, if apktool has its official thread here
http://forum.xda-developers.com/showthread.php?t=640592
Do you get any errors in logcat?
Click to expand...
Click to collapse
I could not find it anywhere else and I did do searches for hours Brilliant tool!
See Attachment, I think it's this line
Code:
E/PackageManager( 138): Package com.android.launcher signatures do not match the previously installed version; ignoring!
However, not sure how to fix it.
andrewb84uk said:
I could not find it anywhere else and I did do searches for hours Brilliant tool!
See Attachment, I think it's this line
Code:
E/PackageManager( 138): Package com.android.launcher signatures do not match the previously installed version; ignoring!
However, not sure how to fix it.
Click to expand...
Click to collapse
Not an expert. But try to uninstall the previous launcher, before installing that one.
shokkapic said:
Not an expert. But try to uninstall the previous launcher, before installing that one.
Click to expand...
Click to collapse
Will try it.
EDIT: Nope, uninstalled re-installed, still black screen.
andrewb84uk said:
I could not find it anywhere else and I did do searches for hours Brilliant tool!
See Attachment, I think it's this line
Code:
E/PackageManager( 138): Package com.android.launcher signatures do not match the previously installed version; ignoring!
However, not sure how to fix it.
Click to expand...
Click to collapse
I think you can't install Launcher just like that, because it's system app. You should do it through update.zip file.
Try to not use apktool, but just unpack Launcher.apk, remove META-INF dir, zip it back, sign and install. If you will get similar problems, then they can't be related to apktool (because you didn't even use it), but to something else.
Brut.all said:
I think you can't install Launcher just like that, because it's system app. You should do it through update.zip file.
Try to not use apktool, but just unpack Launcher.apk, remove META-INF dir, zip it back, sign and install. If you will get similar problems, then they can't be related to apktool (because you didn't even use it), but to something else.
Click to expand...
Click to collapse
If I unzip it, remove META-INF dir, zip it back, sign + install and it works fine. It doesn't work when I edit 1 file by decompiling and compiling, sign, upload it fails but it also fails using APKManager.
EDIT: I have also tried using notepad++ / notepad to edit the xml both to the same issue.
Err... you know, your problem is for sure related to signing/installation and not to apktool. Key error line is here:
E/PackageManager( 138): Package com.android.launcher signatures do not match the previously installed version; ignoring!
Click to expand...
Click to collapse
andrewb84uk said:
If I unzip it, remove META-INF dir, zip it back, sign + install and it works fine. It doesn't work when I edit 1 file by decompiling and compiling, sign, upload it fails but it also fails using APKManager.
Click to expand...
Click to collapse
Could you explain, how is it possible, that you can properly sign rezipped apk, but you can't reapktoold' one? If you get signing issues, then this is totally irrelevant what apktool does. All files could be random binary strings as well cause they aren't even read.
This thread can be deleted or moved to the bin or where ever it needs to go!
idroid84 said:
Usage;
Decoding APKs;
Code:
apktool d <file.apk> <directory to output to>
Compiling APKs*;
Code:
apktool b <directory of decoded apk>
*The compiled apk will be saved to the sub directory "dist", which is in what ever directory you choose to compile.
Click to expand...
Click to collapse
Thank you soooo much!!! It took me hours of searching to find this post and once I did, I had my apk decompressed in under a minute!!! You da man
If your running windows XP here's a right click reg edit I made for making decompiling/compiling quicker-
forum.xda-developers.com/showthread.php?t=935967
Hey guys... really trying to theme for the first time with xml files.
I have done modifying of png which are easy, but just lenghty and detailed.
So now that Gingerbread is out, some of the items have been moved to the xml files.
indeterminate was from 4 and now down to 3. but I want to increase to 8 to mimic honeycomb. Also the progress horizontal was once a png reference file now its in the systemui.apk xml too.
Anyhow short version.... anytime i edit more then 1 line at a time after decompiling, when trying to say it will ask to save as text.
Whats the best file editor for xml? or recommendations.
I use notepad++ on windows, you can also import your decompiled apk into eclipse and use that, it'll also report any errors or mistakes you might make.
Hope this helps.
Yeah I have been using that do and any time I compile and flash it just gives me boot loop.
Question about proper importing to eclips.
Whenever I just flat out decompile ... do my modification, go to recompile, it get errors. In apktool and apkmanager.
Should I extract the resource file and class dex out and then decompile. Cus when I have the resource file in the same directory....at least last nights attempt, apktool finale didn't give me an error and compiled.
I've done a decompile just from apk and imported to eclips and when I try to run, gives error.... "no style availiable" or something like that
Sent from my Droid using XDA App
Thank you!!!
Greetings.
fixing a broken abondon market apk
Could someone fix this app VirginmobileMinuitechecker . I think i found the problem . Virgin Mobile updated there site from logon www1 to www2 . I edited it from the open source and zipped it back up but i cannot get this compile program to run at all . here is the zip master . I made several attempts emailing jay goel but he his MIA .. the app will no longer log in because of the VM website recent changes . TIA
EDIT ,, NEVER MIND . i got it working and fixed that app . works like a charm now pretty good being i don't code for a living.. if you don't mind i posted the fixed app . you may move or delete if it is not proper . thank you for the tutorial .
I've just tried some of the themes available here against the apkmanager tool - decompiling and then compiling the framework-res.apk and twframework-res.apk and all of the custom themes give tons of errors (sometimes won;t even compile back) .. the only one that goes without troubles is the stock framework-res.apk and twframework-res.apk
I'm just wondering whether this is correct or not and where is the issue - is it apkmanager or the themes that are wrong ?
w83 said:
I've just tried some of the themes available here against the apkmanager tool - decompiling and then compiling the framework-res.apk and twframework-res.apk and all of the custom themes give tons of errors (sometimes won;t even compile back) .. the only one that goes without troubles is the stock framework-res.apk and twframework-res.apk
I'm just wondering whether this is correct or not and where is the issue - is it apkmanager or the themes that are wrong ?
Click to expand...
Click to collapse
I never had much luck with APKManager, that's why I use APKTool.
Try v1.3.1 if you can find it, 1.3.2 has problems.
Apk Manager uses apktool too.
@w83
Take a look at log.txt.
I guess it's due to corrupted .9.png.
Solution:
Replace all modded .9.png with original files, decompile, make your changes, compile.
Then you can put in your modded .9.pngs again...
scheichuwe said:
Apk Manager uses apktool too.
@w83
Take a look at log.txt.
I guess it's due to corrupted .9.png.
Solution:
Replace all modded .9.png with original files, decompile, make your changes, compile.
Then you can put in your modded .9.pngs again...
Click to expand...
Click to collapse
Is it really a solution ? .. cause it seems like all of the modded .9.pngs are basically broken
You're right, let's say workaround
For fixing your modded .9.png search for xUltimate draw 9 patcher. I don't know what it's called exactly.
But for editing framework-res.apk the workaround should be acceptable.
I can manage to decompile the theme (usually with some patched pngs messed up) but when I try to compile it (even without any changes) I end up with tons of errors in the form:
apktools/vagreen_frame/res/values/public.xml:3760: error: Public symbol drawable/zzzzz_tw_quickcontact_top_frame declared here is not defined.
(lots of these ones)
any idea what's wrong ?
w83 said:
I can manage to decompile the theme (usually with some patched pngs messed up) but when I try to compile it (even without any changes) I end up with tons of errors in the form:
apktools/vagreen_frame/res/values/public.xml:3760: error: Public symbol drawable/zzzzz_tw_quickcontact_top_frame declared here is not defined.
(lots of these ones)
any idea what's wrong ?
Click to expand...
Click to collapse
Once your 9.pngs are poorly done, errors such as the above would appear. There were only 6 9.png errors and the log generated a loh file size of 130+kb. But once solved, all errors were eliminated.
Sent from my GT-I9000 using XDA App
scheichuwe said:
You're right, let's say workaround
For fixing your modded .9.png search for xUltimate draw 9 patcher. I don't know what it's called exactly.
But for editing framework-res.apk the workaround should be acceptable.
Click to expand...
Click to collapse
I'm either using the android sdk draw9patch to generate the pngs or even GIMP to do it. Just make sure the first and last row/column must be either alpha or black. No other colours are allowed there.
Sent from my GT-I9000 using XDA App
g00ndu said:
I'm either using the android sdk draw9patch to generate the pngs or even GIMP to do it. Just make sure the first and last row/column must be either alpha or black. No other colours are allowed there.
Click to expand...
Click to collapse
Ok so ur saying that after I should correct the patch 9 pngs in the framework and it should compile correctly ? .. so two options: [1] decompile, replace the pngs with correct ones, compile ? .. or .. [2] correct pngs, compile in eclipse, replace in framework, decompile, compile ?
I am pretty sure that I've already tried correcting them using [1] and it didn't help at all .. I was still flooded with errors ..
I guess I'll try to modify things from the bottom up .. take the stock theme with extended menu and play around with it .. are there any significant changes in the .jars inside the /system/framework in most of current themes ?
but still it would be way nicer if I could decompile and compile one of current themes without errors .. I'm so curious how the theme gurus are doing it .. I envy their knowledge
w83 said:
...
but still it would be way nicer if I could decompile and compile one of current themes without errors .. I'm so curious how the theme gurus are doing it .. I envy their knowledge
Click to expand...
Click to collapse
Replace all modded .9.png with original files, decompile, make your changes, compile.
The person who made the theme did it lazily and incorrectly. The first couple versions of my ROM had this problem. Did some research into how .9 PNGs work.
If you want to fix them, I can tell you how. It's a bit tedious.
scheichuwe said:
Replace all modded .9.png with original files, decompile, make your changes, compile.
Click to expand...
Click to collapse
Yep that worked perfectly !! Thx mate for that
I'll try to mod something and see how it works
MikeyMike01 said:
The person who made the theme did it lazily and incorrectly. The first couple versions of my ROM had this problem. Did some research into how .9 PNGs work.
Click to expand...
Click to collapse
Most of the available themes can't be compiled and decompiled without errors
w83 said:
Most of the available themes can't be compiled and decompiled without errors
Click to expand...
Click to collapse
But mine can.
Spent a couple days fixing every .9 PNG one at a time. All you have to do is:
Decompile the unthemed .apk
Copy the broken PNG equivalents from the unthemed .apk
Decompile the themed .apk
Delete the broken .9 PNGs
APK Manager will rename the broken xxxxx.9.png to xxxxx.png
Open the non-broken PNGs in your favorite image editor
Delete everything but the 1 pixel border
Paste the edited PNG over it, without touching the 1 pixel border
Save
Recompile the themed.apk
MikeyMike01 said:
But mine can.
Spent a couple days fixing every .9 PNG one at a time. All you have to do is:
Decompile the unthemed .apk
Copy the broken PNG equivalents from the unthemed .apk
Decompile the themed .apk
Delete the broken .9 PNGs
APK Manager will rename the broken xxxxx.9.png to xxxxx.png
Open the non-broken PNGs in your favorite image editor
Delete everything but the 1 pixel border
Paste the edited PNG over it, without touching the 1 pixel border
Save
Recompile the themed.apk
Click to expand...
Click to collapse
Thank you so very much for sharing this info!!!
MikeyMike01 said:
But mine can.
Click to expand...
Click to collapse
Perfect
MikeyMike01 said:
Delete everything but the 1 pixel border
Paste the edited PNG over it, without touching the 1 pixel border
Click to expand...
Click to collapse
You can just edit the broken png in draw9patch (or gimp or whatever) but sticking to the patch 9 png rules
Thanks for sharing !
Could you briefly explain how the editing in draw9patch is done, please.
MikeyMike01 said:
But mine can.
Spent a couple days fixing every .9 PNG one at a time. All you have to do is:
Decompile the unthemed .apk
Copy the broken PNG equivalents from the unthemed .apk
Decompile the themed .apk
Delete the broken .9 PNGs
APK Manager will rename the broken xxxxx.9.png to xxxxx.png
Open the non-broken PNGs in your favorite image editor
Delete everything but the 1 pixel border
Paste the edited PNG over it, without touching the 1 pixel border
Save
Recompile the themed.apk
Click to expand...
Click to collapse
But lets say I want to change the default blue of 'statusbar_background.9.png' to full plain black. If I leave the 1 pixel border and fill the rest to black, wouldn't I have a blue border in the status bar?
brittosa said:
But lets say I want to change the default blue of 'statusbar_background.9.png' to full plain black. If I leave the 1 pixel border and fill the rest to black, wouldn't I have a blue border in the status bar?
Click to expand...
Click to collapse
No, there's a special one pixel border that has black and transparent pixels that tell the system how to stretch the image without making it look stretched.
That's why you'll note that .9 PNG files are buttons and other things that are used to make different sized objects.
Sent from my Captivate.
I've been debugging my mms themed app and have come up on a problem. Everything works great, but even a simple decompile/recompile seems to break the search messaging function. I get no errors during decompile/recompile, and no installation errors. Search just doesn't work. I'll post a logcat in case somebody can see something i missed. I'm using apk manager 5.0.2 and have also tried multi-tool 1.0.2.
-My question is, could someone decompile, then recompile the stock 4.0.3 mms.apk, then try to search via the magnifying glass at the bottom? Mine always FC's when i hit search. Thanks for the help guys.
also, i cannot decompile with dependencies, as it tells me that the framework-res.apk isn't the correct dependant, try again. decompiling without dependants seems to work fine, but i have a feeling i'll have to be able to get it with dependants since i think the search function uses external sources.
Exactly same problem with gingerbread mms.apk from LG Optimus Black.
If I retouch images or smali code, no problem at all... but when try to modify a .xml inside /values/ and then replace resources.asrc, search function returns a FC!!!!
It must be a format problem, but how to bypass this issue?
Regards.
Huexxx said:
Exactly same problem with gingerbread mms.apk from LG Optimus Black.
If I retouch images or smali code, no problem at all... but when try to modify a .xml inside /values/ and then replace resources.asrc, search function returns a FC!!!!
It must be a format problem, but how to bypass this issue?
Regards.
Click to expand...
Click to collapse
I bet on recompiling, you are including extra XML files you never edited. Apktool has a nasty bug of adding random extra '\' to files. Check your edited files too.
Hmmmm odd, apkmultitool doesn't introduce the bug you report. And I blacked out a stock 4.0.4 apk and search is fine.
good day.
lol i forgot about this thread. I fixed it a long time ago Turned out to be a bug in the version of apktool i was using.
chopper the dog said:
Hmmmm odd, apkmultitool doesn't introduce the bug you report. And I blacked out a stock 4.0.4 apk and search is fine.
good day.
Click to expand...
Click to collapse
artvandelay440 said:
lol i forgot about this thread. I fixed it a long time ago Turned out to be a bug in the version of apktool i was using.
Click to expand...
Click to collapse
/me slaps chopperthedog upside the head with nitsuj17
Hi again!
Some people asked how I did the mod I posted on the thread http://forum.xda-developers.com/showthread.php?t=1738094 and I promised I would say it.
First off, this method will require you to go deep inside binary files, so please don't try to do it if you didn't completely understand every step and know the basics about the hexadecimal, binary diffs, etc.
Before start
I will start saying what was supposed to work. You should use apktool to decode the apk, modify what you want, and then use apktool build it again. But, as of the latest version of apktool I tried (1.4.3), decode and build doesn't work for for Xperia S' framework-res.apk. (Maybe bug http://code.google.com/p/android-apktool/issues/detail?id=313 and http://code.google.com/p/android-apktool/issues/detail?id=256 are related?)
The closest I could get is using apktool 1.4.1, but the generated file was so smaller than the original and I wasn't brave enough to test on my phone.
Anyway, you will need to do this "normal" process (decode and build) for this method too. You can use any version of apktool that decode and build without errors. I used 1.4.1, but I believe a newer version could get a closer output, thus a easy file to do a binary diff. Don't worry, we won't flash these malformed apk's!
So, lets start.
PLEASE, read all the steps before start to understand the whole thing. The main idea is to find some bytes that precedes the value we want to change, then find these bytes on the original resources file and change the value we want.
1. Make sure you have adb, apktool, and everything needed on your path. I will give you the commands assuming all of them are in your path.
2. Get the necessary apk's from your phone:
Code:
[email protected]:~/Android/LT26i$ adb pull /system/framework/framework-res.apk
3972 KB/s (22227101 bytes in 5.463s)
[email protected]:~/Android/LT26i$ adb pull /system/framework/SemcGenericUxpRes.apk
4970 KB/s (2095961 bytes in 0.411s)
3. Install the apk's on apktool
Code:
[email protected]:~/Android/LT26i$ apktool if framework-res.apk nozomi
I: Framework installed to: /home/brunojcm/apktool/framework/1-nozomi.apk
[email protected]:~/Android/LT26i$ apktool if SemcGenericUxpRes.apk nozomi
I: Framework installed to: /home/brunojcm/apktool/framework/2-nozomi.apk
4. decode and build the framework-res.apk WITHOUT changing anything:
Code:
[email protected]:~/Android/LT26i$ apktool d -f -t nozomi framework-res.apk framework-res
(some lines, with warnings)
I: Done.
I: Copying assets and libs...
Code:
[email protected]:~/Android/LT26i$ apktool b framework-res unchanged/framework-res.apk
(few lines)
I: Building apk file...
5. Do the same of the step above, but CHANGING what you want before build. Pay attention to the output folder of the build, it's different from the previous step.
Code:
[email protected]:~/Android/LT26i$ apktool d -f -t nozomi framework-res.apk framework-res
(some lines, with warnings)
I: Done.
I: Copying assets and libs...
(CHANGE WHAT YOU WANT)
Code:
[email protected]:~/Android/LT26i$ apktool b framework-res changed/framework-res.apk
(few lines)
I: Building apk file...
I changed the config_showNavigationBar, inside framework-res/res/values/bools.xml, but you can try changing what you want. I recommend you to start changing one single boolean value, then you can try to do more advanced things.
6. Here starts the fun! Since we have almost the same apk file, because we built both using the same apktool version, the only different bytes must be the boolean we changed. So we can unpack both apk's and run a binary diff of the resources.arsc. I'm using the vbindiff (apt-get install vbindiff) on ubuntu, but there should be other binary diffs or hexadecimal editors. So unpack and run the following:
Code:
vbindiff unchanged/framework-res.apk_FILES/resources.arsc changed/framework-res.apk_FILES/resources.arsc
It will show you the binary representation of the two files, the changed and the unchanged. Press enter once and you will see some chars in red (if you don't see, you did something worng). These represent the changed value. It was 00 00 00 00 (false) and is FF FF FF FF (true) on the modified file. Now we can observe what we have around the value we want to changed. We need to observe because we're going to edit the original file. Note that there is a column containing a hexa sequence (27, 28, 29, 2A, 2B). Our changed value is in the same line of the 29. This is the line that starts with '0077 F500'.
Copy the text of the vbindiff, containing the changed value and everything around it, to a draft file for further reference. I've attached a print of this screen, se below.
7. Now we need to do the final ninja hit: Change the original apk. Actually, the original resources.arsc. But things are no so easy, because the value we need to change is not on the same position it was is the file we changed. If we go to the position 0077 F500, something completely diferent will be there. So we need to search for something near the value we want to change. I will search for the sequence '29 1D', which is 8 bytes before the value we want to change. Yes, it's a short sequence and will occours a lot of times, but it is the best we can use. Maybe '00 29 1D', but no more than that. Let's go, unpack the original framework-res.apk and run:
Code:
vbindiff framework-res.apk_FILES/resources.arsc
Now hit F to find the sequence, and H to Hexa sequence, and type the sequence you choose (here, '00 29 1D'). To find the next occourrence, press F, then N. Do it until you find this sequence in a similiar way of the original file, having one line below with 2A, and below 2B etc. It should be near '007D C5CF'. Now you need to press E, go to the column where you have '00 00 00 00' and change to 'FF FF FF FF'. Pay attention to the other lines to change the right columns. The edited values will be in yellow. You can see the second attached print screen.
8. This is the easiest step, just copy the modified resources.arsc to the original apk. It should not be the apktool-built one, it should be the file you modified on the vbindiff editor.
I did it using the Gnome archive manager, just drag and drop the resources.arsc inside the archiver window after open the framework-res.apk.
And voilà! Your modded apk is ready!
------
Hope someone can understand this and make some mods. I did my best to explain what I did, but it's a really hard procedure thus not easy to explain.
If you have any doubts, just post and I will try to answer!
And if you like, click thanks to me!
as far as i know SemcGenericUxpRes.apk is odexed, this doesn't affect the process?
iBotPeaches has taken over development of apktool. The development thread is here:
http://forum.xda-developers.com/showthread.php?t=1755243
The latest version seems a lot better than 1.4.3
---------- Post added at 10:36 AM ---------- Previous post was at 10:35 AM ----------
Yakandu said:
as far as i know SemcGenericUxpRes.apk is odexed, this doesn't affect the process?
Click to expand...
Click to collapse
i believe only the code is odexed so you can make changes to the resources without breaking the odex file.
Frist thanks to brunojcm for share this tutorial
finally with this tutorial i could make smaller on screen buttons .
Install via CWM : Smaller On Screen Buttons.zip
Tested on .58 stock rom
Some mods by me SHOULD come tomorrow after school. Nothing big, just a few things.
Sent from my LT26i with Tapatalk 2
Soheil_rf said:
Frist thanks to brunojcm for share this tutorial
finally with this tutorial i could make smaller on screen buttons.
Install via CWM : Smaller On Screen Buttons.zip
Tested on .58 stock rom
Click to expand...
Click to collapse
Cool you understood it!
What did you change to accomplish that? just booleans or integers too? were they easy to find?
brunojcm said:
Cool you understood it!
What did you change to accomplish that? just booleans or integers too? were they easy to find?
Click to expand...
Click to collapse
after enable navigation bar in bools.xml you can change size of bar in dimens.xml ( navigation_bar_height and navigation_bar_width )
Soheil_rf said:
Frist thanks to brunojcm for share this tutorial
finally with this tutorial i could make smaller on screen buttons .
http://img818.imageshack.us/img818/1254/screenshot2012080916234.png
http://img195.imageshack.us/img195/8084/screenshot2012080916240.png
http://img402.imageshack.us/img402/2717/screenshot2012080916242.png
Install via CWM : Smaller On Screen Buttons.zip
Tested on .58 stock rom
Click to expand...
Click to collapse
How you made that? I get confused on the file comparing thing... Or you just have to decompile, change the DPI and compile back?
Your file works fine on .452 firmware. However, it has some icon bugs on status bar (the USB connnection and debugging ones) and the carrier name stays a little over where it should be.
Felimenta97 said:
How you made that? I get confused on the file comparing thing... Or you just have to decompile, change the DPI and compile back?
Your file works fine on .452 firmware. However, it has some icon bugs on status bar (the USB connnection and debugging ones) and the carrier name stays a little over where it should be.
Click to expand...
Click to collapse
Try to reading Tutorial again , its simple but gets some time
maybe you are using moded SystemUI.apk or .58 FW had some difference
here its normal
Soheil_rf said:
Try to reading Tutorial again , its simple but gets some time
...
Click to expand...
Click to collapse
Could make your mod, Felimenta97?
brunojcm said:
Could make your mod, Felimenta97?
Click to expand...
Click to collapse
Nope. Always something Ib my way. Was replacing the resources.arsc after I rebuild the app. But I read I have to replace the Meta-Inf and Manifest.xml. But now no time.
Sent from my LT26i with Tapatalk 2
You wont be able to recompile and use the same apk that's the entire point to this article and getting around this limitaion.
Simply put hex edit the resources.arsc after binary dif finds the changes integers and replace with the original in the framework-res.apk.
-smc
somemadcaaant said:
You wont be able to recompile and use the same apk that's the entire point to this article and getting around this limitaion.
Simply put hex edit the resources.arsc after binary dif finds the changes integers and replace with the original in the framework-res.apk.
-smc
Click to expand...
Click to collapse
Well, I see. I'm just trying to see what would be the effect of setting True to the Animate Screen Lights line on bools.xml I'm no developer, just a simple user trying to do some mods by myself
Sent from my LT26i with Tapatalk 2
Felimenta97 said:
Well, I see. I'm just trying to see what would be the effect of setting True to the Animate Screen Lights line on bools.xml I'm no developer, just a simple user trying to do some mods by myself
Sent from my LT26i with Tapatalk 2
Click to expand...
Click to collapse
What was it supposed to do?
brunojcm said:
What was it supposed to do?
Click to expand...
Click to collapse
As far as I know, it's the responsible for the screen off animation, at least on GB.
Sent from my LT26i with Tapatalk 2
Don't get discouraged, i've never tried to play with the screen animations but maybe there's something else you need to find/edit? Seems like a fairly small change you tried to make.
If it's not a small change not being able to recompile the framework-res file makes doing more advanced mods frustratingly impossible, i've got several mods waiting to go for our phone when we're able to.
-smc
I want to try myself some mods too. 30 volume step, Sense multitasking, etc. And it compiles perfectly (except when it says that there it's something that it's missing a translation, a file I didn't even touched). One day, when I have more time, I will try to do such things, slowly.
Sent from my LT26i with Tapatalk 2
Why to use apktool instead of 7zip?
I tried replacing a .png in framework.res and get errors.
Erachter said:
Why to use apktool instead of 7zip?
I tried replacing a .png in framework.res and get errors.
Click to expand...
Click to collapse
Because it involves a lot more than just removing files
Sent from my LT26i with Tapatalk 2
Thanks to iBotPeaches the latest custom build of apktool is now out:
[UTIL][Sept 2 2012] Apktool v1.5.0 - a tool for reverse engineering apk files
A new version has been released!
v1.5.0 (Released September 2 - 2012 ) Codename : Pikmin
Fix for colours being decompiled with improper hex colours
Fix for <string-array> being treated as array on occasion
Support for Mac OS X user:home, instead of dumping frames into /home
Updated internal framework.jar to API16
Added <user-sdk> reading to insert into apktool.yml to help with aapt building
Supported -d mode
Added --verbose mode to output contents of AAPT (note this is a HUGE output). Only used for debugging.
Ignore bootclasspath on debug mode. (Causes some classes in smali to be fail decompile)
New AAPT (Linux only) - http://miui.connortumbleson.com/othe...apt/linux/aapt
Get the patched aapt.
@Felimenta97 if your getting the language error it should be normal depending on what framework you are using, single language is never set for a multilanguage firmware.
-smc
Okay, so I am trying to get the navbar working on the Samsung Galaxy Note 3. Pretty much, I have a feeling that SystemUI is missing the icons for the navbar, which causes it to crash when the build.prop has the line "qemu.hw.mainkeys=0". The SystemUI has all the other files that were required for the S4 sysui mod, except for the icons. Being a noob at this, I went ahead and tried to add the icons, but my apk resulted in "System UI has stopped.".
So I decided maybe I am doing something wrong. So with Android Multitool for windows, I installed framework-res.apk, SystemUI.apk, and twframework-res.apk. Next I select the SystemUI.apk for decompiling, and decompile it. Then I simply select the decompiled directory (didn't modify anything!), and recompile it. I then open the new SystemUI.apk in 7z and add the META-INF and AndroidManifest.xml from the old SystemUI.apk. I then select the newly compiled SystemUI.apk for signing, then I sign it.
This is just decompiling, then building the same thing without modifications. SystemUI.apk before decompiling is 2.7 MB, the newly compiled one is only 2 MB! Something is missing out of the new one, but when I compare them in 7z, the only thing I can see that is different is the packed size; whereas the old one has files and folders that take up more space packed than the new one.
When I try doing this with just apktool and cmd, I get java errors like crazy, and the whole SystemUI.apk ends up only half decompiling.
Any idea what I am doing wrong?
Your best bet would be to copy the log to pastebin, and post it in the apktool support thread. Get more views there for sure. Which version of apktool are you using? Can you decompile and recompile anything? Also, if you want post your systemui up and i could see if I can get it to work, narrow it down to a problem on your end that way.
Sent from my SM-N900T using Xparent Skyblue Tapatalk 2
This is my first time doing this, so of course I make a noob mistake! I thought I had to sign ALL apks, but this is a SYSTEM app, and I don't sign it. All is well! Thanks for the reply. I also updated my apktool to 1.5.2, so that may have helped too.
all you have to do is add a + before the @ sign in the line that is giving you errors....umm depending if it is xml errors....
post the errors.....
gakio12 said:
This is my first time doing this, so of course I make a noob mistake! I thought I had to sign ALL apks, but this is a SYSTEM app, and I don't sign it. All is well! Thanks for the reply. I also updated my apktool to 1.5.2, so that may have helped too.
Click to expand...
Click to collapse
You don't need to sign it? I have also this problem. It gives me error that SystemUI has stopped.