[GUIDE][TOOL] Android L 5.0 (Lollipop) deodex tool for windows! Oat2dex convertor. - Android Software/Hacking General [Developers Only]

EDIT 2 : WAIT NO MORE! Thanx to our friend @joeldroid for his AMAZING TOOL that can batch deodex lollipop files.!
Head over HERE and learn more about it. It is in early stages but works perfectly!
EDIT : I didn't made these tools as I said I compiled (gathered) a set of tools and wrote the guide and so mentioned on XDA Portal that I created a "Quick Guide" please refer that point. Credit goes to the devs of these tool creator. I am extremely sorry for my ignorance but I don't know the devs, please PM me your names so I can give proper credits.
A related guide to this can be found here on this blog, here is the link http://softdx.kr/220200813802
Hello Guys,
I am back with another exciting guide. Deodex lollipop apps and jar's now successfully.! This tool can be useful for ROM developers, chefs and themers and for those who can port apps.
Now on XDA Portal : http://www.xda-developers.com/android/deodex-lollipop-system-apps-with-ease/
I compiled together a set of tool to deodex Lollipop. I'll be attaching it at the end of the thread.
Well now lets get to it.
As we know in Android 5.0 Lollipop framework, app, priv-app folder we have * .apk files and * .jar file, and subsequently when you look at the sub-folder called * .odex files they have a specific folder for art runtime in order to compress into two modes.
* odex.art.xz -> The art mode to native file.
* .odex.xz -> 7zip * .odex appears when you unzip the file.
* .odex.xz unpack the file compression, uses the * .odex file.
unless the ARM is compressed folder * .odex
So in order to deodex files we need this deodex tool and your apk along with *.odex.xz.
Procedure
1) Extract the attached 7z file to desktop and hold right shift key and right click mouse button, you'll see "Open Command Prompt here" click on it.
2) Now a command prompt window will open. Now place you .apk and .odex.xz file there and type "7za x *.odex.xz " and press enter. This will lead to xz uncompressing and output file we will recieve as an odex, though a new format odex will be given in output so we need oat2dex converter
3) Now enter this command "oat2dex.bat *.odex and press Enter. With this command, you confirm that there is OAT file and DEX file header present. Note if you face any errors during this command you'll unfortunately have to give up as that apk won't be converted.
4) Now assuming you got no error in converting enter this command "oat2dex.bat *.odex temp.dex. This command will will you give you your required output ,i.e. .temp.dex. file is created, it is odex file with the old structure.
5) Now using the baksamli / smali to De-Odex use this command "java -jar baksmali-2.0.3.jar -a 21 -x temp.dex -o deodex". As you all know this command will decompile dex and as a result we will find find a deodex output folder without any error.
6) Now to compile the output back to classes.dex use this command "java -jar smali-2.0.3,jar -a 21 deodex -o classes.dex".
7) Now to put classes.dex into apk use this command "7za u -tzip *.apk classes.dex"
Hope this guide makes you to deodex your required file(s) properly
P.S. I am not big of a dev and this guide may contain a number of errors as this took me around 2 hours to figure out the proper way to write this guide , if you spot any error please do help me correcting it.
I am writing a program that can batch deodex all files, but as I said I am no dev Hope someone can do this to write a program to batch deodex.
Please hit like if this helped you :fingers-crossed:
Any suggestion(s) are welcome.:laugh:

For Example
Say we need to deodex SemcVideo.apk
Keep SemcVideo.odex in the folder and then
1) 7za x SemcVideo.odex.xz
To decompress the compressed files that SemcVideo.odex has and to use them for later purpose.
Then, using the oat2dex tool*
2) oat2dex.bat SemcVideo.odex
With this command, you confirm that OAT file and DEX file header is present.
If a file error occurs here it will not convert.
In order to convert the file name to dex format.
3) oat2dex.bat SemcVideo.odex temp.dex
temp.dex file is created, it is odex file with the old structure.
Now, using the baksamli / smali to De-Odex.
4) java -jar baksmali-2.0.3.jar -a 21 -x temp.dex -o deodex
If a deodex folder is created without any error during Decompile, next step is to pack it properly.
Now, the recompiling process to generate classes.dex file.
5)java -jar smali-2.0.3.jar -a 21 deodex -o classes.dex
Now, without any error a classes.dex file is generated.
Now to add this in apk
6) 7za u -tzip SemcVideo.apk classes.dex
This will update SemcVideo.apk video files with file newly created classes.dex
Hope this helps.

Nice, I will be trying this out a little later. Would love a batch option though. Major pain to deodex everything manually LOL
Edit: A little lost here. So I extracted the shamu factory image, and I have the full set of system files. I extract the package you uploaded. So I would simply drop an apk or jar into the directory with the tools, along with its matching odex file, right? Could you provide an example of how to deodex say "SystemUI.apk"? I am not following the steps and understanding what you are suggesting we do . .

hlxanthus said:
Nice, I will be trying this out a little later. Would love a batch option though. Major pain to deodex everything manually LOL
Click to expand...
Click to collapse
Yup working on the batch deodex thing hope some advanced dev can write a program and help in batch deodexing

hlxanthus said:
Nice, I will be trying this out a little later. Would love a batch option though. Major pain to deodex everything manually LOL
Edit: A little lost here. So I extracted the shamu factory image, and I have the full set of system files. I extract the package you uploaded. So I would simply drop an apk or jar into the directory with the tools, along with its matching odex file, right? Could you provide an example of how to deodex say "SystemUI.apk"? I am not following the steps and understanding what you are suggesting we do . .
Click to expand...
Click to collapse
Check Post 2 added an example

Excellent!! That was all it took to figure it out. As they say, now we are cooking with gas. :good:
Successfully deodexed several apks and jars from the nexus 6 factory images, trying to figure out where the heck to shoehorn in an extended power menu . . but android.policy.jar doesnt have an odex . .

any method to do this on linux?

what do u push to phone? i pushed apk i drug over earlier and wont install?
---------- Post added at 07:42 PM ---------- Previous post was at 07:40 PM ----------
i did following:
1) unzipped the oat2dex archive
2) run command prompt
3) drag apk and apk.odex.xz
4) follow all steps successfuly
5) what gets pushed to phone? I found apk i drug over in step 3? or do i find in a folder or where lol.. is the apk.odex go too?

This doesn't touch your phone at all . . you put the apk and odex file in the tools directory and follow the guide, see the example in the second post.

Tech N You said:
For Example
Say we need to deodex SemcVideo.apk
Keep SemcVideo.odex in the folder and then
1) 7za x SemcVideo.odex.xz
To decompress the compressed files that SemcVideo.odex has and to use them for later purpose.
Then, using the oat2dex tool*
2) oat2dex.bat SemcVideo.odex
With this command, you confirm that OAT file and DEX file header is present.
If a file error occurs here it will not convert.
In order to convert the file name to dex format.
3) oat2dex.bat SemcVideo.odex temp.dex
temp.dex file is created, it is odex file with the old structure.
Now, using the baksamli / smali to De-Odex.
4) java -jar baksmali-2.0.3.jar -a 21 -x temp.dex -o deodex
If a deodex folder is created without any error during Decompile, next step is to pack it properly.
Now, the recompiling process to generate classdex.dex file.
5)java -jar smali-2.0.3.jar -a 21 deodex -o classes.dex
Now, without any error a classes.dex file is generated.
Now to add this in apk
6) 7za u -tzip SemcVideo.apk classes.dex
This will update SecVideo.apk video files with file newly created classes.dex
Hope this helps.
Click to expand...
Click to collapse
Thanks much for this. I been have using the oat2dex script (Pau Oliva) on my linux build but have not been able to successfully deodex. I got the classes extracted but hit the wall there. I just gave you method a quick try with my sysui apk and i got an fc on reboot. I will start fresh in the morning and report back to you. I am currenty using an N9 with LRX22C stock factory images. Also, I thought I understood that JesusFreke may need to fix the smali/baksmali for us to properly deodex lollipop.
Regards

hlxanthus said:
This doesn't touch your phone at all . . you put the apk and odex file in the tools directory and follow the guide, see the example in the second post.
Click to expand...
Click to collapse
i know.. i meant there is no way to port apks using oat2dex? after deodex what do we push to phone?

can someoen explain to me whats ht epoint of doing this guide?
will it make lollypop GPE compatible with xposed?

anyone know how to convert the modified dex file back to oat format odex?
i found dex2oat, but it is an android binary; would like to be able to convert on pc.
i'm hoping there's a way to do this to be able to make minor smali edits without deodexing the entire system.

hlxanthus said:
Excellent!! That was all it took to figure it out. As they say, now we are cooking with gas. :good:
Successfully deodexed several apks and jars from the nexus 6 factory images, trying to figure out where the heck to shoehorn in an extended power menu . . but android.policy.jar doesnt have an odex . .
Click to expand...
Click to collapse
I am so sorry for late reply. Glad it worked. Some files that don't have .odex.rz can be deodexed simply by Xultimate. Give a try

Hi, no I am sorry but I have no expertise on Linux may be some of you can try this to port to linux

fhem said:
Thanks much for this. I been have using the oat2dex script (Pau Oliva) on my linux build but have not been able to successfully deodex. I got the classes extracted but hit the wall there. I just gave you method a quick try with my sysui apk and i got an fc on reboot. I will start fresh in the morning and report back to you. I am currenty using an N9 with LRX22C stock factory images. Also, I thought I understood that JesusFreke may need to fix the smali/baksmali for us to properly deodex lollipop.
Regards
Click to expand...
Click to collapse
Great, If you face any FC issues try to avoid those apk's as this is still a beta phase but many devs out there can work on this to make it stable.

lewonsky said:
can someoen explain to me whats ht epoint of doing this guide?
will it make lollypop GPE compatible with xposed?
Click to expand...
Click to collapse
Hi, First refer this guide for difference b/w odex and deodex http://forum.xda-developers.com/showthread.php?p=40026270#post40026270
It will not make it compatible with Xposed, but you can manually theme it as many themers do or you can port apps to different android versions.

elliwigy said:
i know.. i meant there is no way to port apks using oat2dex? after deodex what do we push to phone?
Click to expand...
Click to collapse
After deodexing the files successfully you can create flashable zip and flash via recovery, as I can see that Lollipop already has TWRP for it.

Tech N You said:
Hello Guys,
I am back with another exciting guide. Deodex lollipop apps and jar's now successfully.! This tool can be useful for ROM developers, chefs and themers and for those who can port apps.
Now on XDA Portal : http://www.xda-developers.com/android/deodex-lollipop-system-apps-with-ease/
I compiled together a set of tool to deodex Lollipop. I'll be attaching it at the end of the thread.
Well now lets get to it.
As we know in Android 5.0 Lollipop framework, app, priv-app folder we have * .apk files and * .jar file, and subsequently when you look at the sub-folder called * .odex files they have a specific folder for art runtime in order to compress into two modes.
* odex.art.xz -> The art mode to native file.
* .odex.xz -> 7zip * .odex appears when you unzip the file.
* .odex.xz unpack the file compression, uses the * .odex file.
unless the ARM is compressed folder * .odex
So in order to deodex files we need this deodex tool and your apk along with *.odex.xz.
Procedure
1) Extract the attached 7z file to desktop and hold right shift key and right click mouse button, you'll see "Open Command Prompt here" click on it.
2) Now a command prompt window will open. Now place you .apk and .odex.xz file there and type "7za x *.odex.xz " and press enter. This will lead to xz uncompressing and output file we will recieve as an odex, though a new format odex will be given in output so we need oat2dex converter
3) Now enter this command "oat2dex.bat *.odex and press Enter. With this command, you confirm that there is OAT file and DEX file header present. Note if you face any errors during this command you'll unfortunately have to give up as that apk won't be converted.
4) Now assuming you got no error in converting enter this command "oat2dex.bat *.odex temp.dex. This command will will you give you your required output ,i.e. .temp.dex. file is created, it is odex file with the old structure.
5) Now using the baksamli / smali to De-Odex use this command "java -jar baksmali-2.0.3.jar -a 21 -x temp.dex -o deodex". As you all know this command will decompile dex and as a result we will find find a deodex output folder without any error.
6) Now to compile the output back to classes.dex use this command "java -jar smali-2.0.3,jar -a 21 deodex -o classes.dex".
7) Now to put classes.dex into apk use this command "7za u -tzip *.apk classes.dex"
Hope this guide makes you to deodex your required file(s) properly
P.S. I am no dev and this guide may contain a number of errors as this took me around 2 hours to figure out the proper way to write this guide , if you spot any error please do help me correcting it.
I am writing a program that can batch deodex all files, but as I said I am no dev Hope someone can do this to write a program to batch deodex.
Please hit like if this helped you :fingers-crossed:
Any suggestion(s) are welcome.:laugh:
Click to expand...
Click to collapse
don't be posting the you create this mode ..! i was the one the found how to get the job down ..thank you to (Goldie) and ( tdunham) and SAC23) for creating the tools ...NOT YOU ! give the credit to proper person.. .it's not about creating a conflict without you.
ORIGINAL
http://forum.xda-developers.com/gal...-5-0-gonna-t2961967/post57262607#post57262607

hlxanthus said:
Excellent!! That was all it took to figure it out. As they say, now we are cooking with gas. :good:
Successfully deodexed several apks and jars from the nexus 6 factory images, trying to figure out where the heck to shoehorn in an extended power menu . . but android.policy.jar doesnt have an odex . .
Click to expand...
Click to collapse
You can find it on "/system/framework/arm/" directory.
---------- Post added at 11:18 PM ---------- Previous post was at 11:13 PM ----------
Tech N You said:
For Example
Now to add this in apk
6) 7za u -tzip SemcVideo.apk classes.dex
This will update SecVideo.apk video files with file newly created classes.dex
Hope this helps.
Click to expand...
Click to collapse
Thank you very much!!But, do you know how to re-odex the modified dex file?

Related

[GUIDE]How to port miui for epic.

My epic was lost,so I cannt continue to work for it.
Now i make a porting guide for you.You can continue to work for it based on the present build.It may need more additional works in the furture if the cm7 fixes others things.
1. Download miui_port_ns.zip and ns (or ns 4g,or others)miui rom from miui.us.
miui_port_ns.zip contains some files come from cm7 and EH17. What we need to do is that replace some files of miui.us latest rom with miui_port_ns's ones.
2. Extract miui_port_ns.zip to “miui_port_ns”.
3. Extract the ns(or ns 4g)miui rom to a new folder,then rename it “miui_epic”.
4. cd into “miui_epic”,delete all folders and files except “system” folder.(In the future,if our cm7 support mtd,you may need reserve some related files)
5. copy kernel_update/ and META-INF/ folders to “miui_epic”
6. cd into “miui_epic/system/vendor”
(1) delete bin/pvrsrvinit
(2) delete etc/
(3) cut and replace lib/ to system/lib/
7. cd into “miui_epic/system/lib”,delete egl/ and hw/ folders.
8. Cd into “miui_epic/system/app”,delete Nfc.apk and Tag.apk(nfc related).
9. Copy and replace “miui_port_ns/system/” to “miui_epic/system/”.
10. Modify build version in miui_epic/system/buid.prop.
11. Modify system/framework/ framework.jar to enable data:
(1) Smali framework.jar: apktool d framework.jar
(2) Copy and replace “miui_port_ns/framework.jar/com” to “framework.jar.out/smali/com”
(3) Baksmali framework.jar: apktool b framework.jar.out
(4) Copy and replace framework.jar.out/dist/ framework.jar to miui_epic/system/framework/
12. Modify system/framework/ framework-res.apk to remove “Roaming Indicator” chars:
(1) apktool d framework-res.apk
(2) Cd into framework-res/res,open strings.xml in “values”,” values-en-rUS”,” values-zh-rCN”,search for “roamingText1”,set value null,then save them.
(3) apktool b framework-res
(4) Replace miui_epic/system/framework/ framework-res.apk’s resources.arsc with framework-res/build/apk/resources.arsc.
13. The last step:cd into miui_epic,zip “kernel_update”,” META-INF” and ” system” to a zip file.You also can sign it(not have to).Then flash it!
Thanks:EpicCM team,xboxfanj and and many other contributors.
bxfxf said:
My epic was lost,so I cannt continue to work for it.
Now i make a porting guide for you.You can continue to work for it based on the present build.It may need more additional works in the furture if the cm7 fixes others things.
1. Download miui_port_ns.zip and ns (or ns 4g,or others)miui rom from miui.us.
2. Extract miui_port_ns.zip to “miui_port_ns”.
3. Extract the ns(or ns 4g)miui rom to a new folder,then rename it “miui_epic”.
4. cd into “miui_epic”,delete all folders and files except “system” folder.(In the future,if our cm7 support mtd,you may need reserve some related files)
5. copy kernel_update/ and META-INF/ folders to “miui_epic”
6. cd into “miui_epic/system/vendor”
(1) delete bin/pvrsrvinit
(2) delete etc/
(3) cut and replace lib/ to system/lib/
7. cd into “miui_epic/system/lib”,delete egl/ and hw/ folders.
8. Cd into “miui_epic/system/app”,delete Nfc.apk and Tag.apk(nfc related).
9. Copy and replace “miui_port_ns/system/” to “miui_epic/system/”.
10. Modify build version in miui_epic/system/buid.prop.
11. Modify system/framework/ framework.jar to enable data:
(1) Smali framework.jar: apktool d framework.jar
(2) Copy and replace “miui_port_ns/framework.jar/com” to “framework.jar.out/smali/com”
(3) Baksmali framework.jar: apktool b framework.jar.out
(4) Copy and replace framework.jar.out/dist/ framework.jar to miui_epic/system/framework/
12. Modify system/framework/ framework-res.apk to remove “Roaming Indicator” chars:
(1) apktool d framework-res.apk
(2) Cd into framework-res/res,open strings.xml in “values”,” values-en-rUS”,” values-zh-rCN”,search for “roamingText1”,set value null,then save them.
(3) apktool b framework-res
(4) Replace miui_epic/system/framework/ framework-res.apk’s resources.arsc with framework-res/build/apk/resources.arsc.
13. The last step:cd into miui_epic,zip “kernel_update”,” META-INF” and ” system” to a zip file.You also can sign it(not have to).Then flash it!
Thanks:EpicCM team,xboxfanj and and many other contributors.
Click to expand...
Click to collapse
Awesome! Sorry to hear about your epic though. Thanks for the work you've put into it, and thanks for the future work that this will inspire.
Thanks for this. Maybe more devs can jump on this. Think we seen many modified touchwiz roms!!
Sent from my SPH-D700 using Tapatalk
Thank you bxfxf. I'll miss you.
Sent from my SPH-D700 using Tapatalk
I hope other dev's pick this up! I love this ROM! I hope it does die!
Thank you so much for your work! You've done a hell of a job!
bxfxf said:
My epic was lost,so I cannt continue to work for it.
Now i make a porting guide for you.You can continue to work for it based on the present build.It may need more additional works in the furture if the cm7 fixes others things.
Click to expand...
Click to collapse
Thank you for all of your hard work and for these wonderful instructions!
joshts0 said:
I hope other dev's pick this up! I love this ROM! I hope it does die!
Thank you so much for your work! You've done a hell of a job!
Click to expand...
Click to collapse
Lol... just going to let you know.. you said you hope the rom does die
I'm pretty sure yall knew someone was gonna ask this sooner or later..
but, is there anyway a flashable version of this can be uploaded..
becasue I dont know what..
"cd into" means (maybe copy directory.. but I dont think thats right..)
"Smali" means..
"Baksmali" means..
"apktool b framework-res" mean..
pretty much im lost after step 3. "Extract the ns(or ns 4g)miui rom to a new folder,then rename it “miui_epic”."
I dont mind doing it myself and learning.. So maybe a link to a video that goes thru the steps..
bigdreco said:
I'm pretty sure yall knew someone was gonna ask this sooner or later..
but, is there anyway a flashable version of this can be uploaded..
becasue I dont know what..
"cd into" means (maybe copy directory.. but I dont think thats right..)
"Smali" means..
"Baksmali" means..
"apktool b framework-res" mean..
pretty much im lost after step 3. "Extract the ns(or ns 4g)miui rom to a new folder,then rename it “miui_epic”."
I dont mind doing it myself and learning.. So maybe a link to a video that goes thru the steps..
Click to expand...
Click to collapse
These are commands that need to be run
"Cd" means change directory, move to folder etc.
"Smali" and "baksmali" are used to decompile and compile .jars basically.
And "apktool d framework-res.apk" will decompile the framework-res.apk.
If I'm wrong correct me please
Sent from my Samsung Legen-wait for it-dary! 4g
bigdreco said:
I'm pretty sure yall knew someone was gonna ask this sooner or later..
but, is there anyway a flashable version of this can be uploaded..
becasue I dont know what..
"cd into" means (maybe copy directory.. but I dont think thats right..)
"Smali" means..
"Baksmali" means..
"apktool b framework-res" mean..
pretty much im lost after step 3. "Extract the ns(or ns 4g)miui rom to a new folder,then rename it “miui_epic”."
I dont mind doing it myself and learning.. So maybe a link to a video that goes thru the steps..
Click to expand...
Click to collapse
If i understand what you are saying correctly...
A flashable version has been posted for a while: here
These instructions are for developers to be able to take the latest version as MIUI is updated and recompile it so that we have the latest version of MIUI available for our phones.
Death259 said:
If i understand what you are saying correctly...
A flashable version has been posted for a while: here
These instructions are for developers to be able to take the latest version as MIUI is updated and recompile it so that we have the latest version of MIUI available for our phones.
Click to expand...
Click to collapse
Yea.. that is the version that I was using for about a week, up till today..
but as I was reading the instructions from this one.. I noticed that it compiles files from miui_port_ns.zip with files from miui.us.. and I know miui.us is the "american version".. so I figured that it would take away most of the Japanese language/apps that I don't understand..
So, maybe this is a dumb question...
But aren't steps 6-8 irrelevant, if you proceed with step 9?
ac16313 said:
These are commands that need to be run
"Cd" means change directory, move to folder etc.
"Smali" and "baksmali" are used to decompile and compile .jars basically.
And "apktool d framework-res.apk" will decompile the framework-res.apk.
If I'm wrong correct me please
Sent from my Samsung Legen-wait for it-dary! 4g
Click to expand...
Click to collapse
yea,you are right!
I am sorry my english is poor,these instructions may have some grammar errors.
Should the step 12(4) comes before 12(3)?
Sent from my SPH-D700 using Tapatalk
hienkhieu said:
Should the step 12(4) comes before 12(3)?
Sent from my SPH-D700 using Tapatalk
Click to expand...
Click to collapse
No.Should do "apktool b framework-res" first,then you can get the new file "resources.arsc" in framework-res/build/apk/ ,then put it in the original framework-res.apk.
bigdreco said:
Yea.. that is the version that I was using for about a week, up till today..
but as I was reading the instructions from this one.. I noticed that it compiles files from miui_port_ns.zip with files from miui.us.. and I know miui.us is the "american version".. so I figured that it would take away most of the Japanese language/apps that I don't understand..
Click to expand...
Click to collapse
Lol... that was a one time messup. You just got lucky with the one you tried Everyone other version i have used doesn't have the language issue.
Death259 said:
Lol... that was a one time messup. You just got lucky with the one you tried Everyone other version i have used doesn't have the language issue.
Click to expand...
Click to collapse
OHHH.. OK..well imma upgrade to the new version that was posted yesterday 11/17/2011 and see how it works out for me.. thanks!!
bxfxf said:
My epic was lost,so I cannt continue to work for it.
Now i make a porting guide for you.You can continue to work for it based on the present build.It may need more additional works in the furture if the cm7 fixes others things.
1. Download miui_port_ns.zip and ns (or ns 4g,or others)miui rom from miui.us.
miui_port_ns.zip contains some files come from cm7 and EH17. What we need to do is that replace some files of miui.us latest rom with miui_port_ns's ones.
2. Extract miui_port_ns.zip to “miui_port_ns”.
3. Extract the ns(or ns 4g)miui rom to a new folder,then rename it “miui_epic”.
4. cd into “miui_epic”,delete all folders and files except “system” folder.(In the future,if our cm7 support mtd,you may need reserve some related files)
5. copy kernel_update/ and META-INF/ folders to “miui_epic”
6. cd into “miui_epic/system/vendor”
(1) delete bin/pvrsrvinit
(2) delete etc/
(3) cut and replace lib/ to system/lib/
7. cd into “miui_epic/system/lib”,delete egl/ and hw/ folders.
8. Cd into “miui_epic/system/app”,delete Nfc.apk and Tag.apk(nfc related).
9. Copy and replace “miui_port_ns/system/” to “miui_epic/system/”.
10. Modify build version in miui_epic/system/buid.prop.
11. Modify system/framework/ framework.jar to enable data:
(1) Smali framework.jar: apktool d framework.jar
(2) Copy and replace “miui_port_ns/framework.jar/com” to “framework.jar.out/smali/com”
(3) Baksmali framework.jar: apktool b framework.jar.out
(4) Copy and replace framework.jar.out/dist/ framework.jar to miui_epic/system/framework/
12. Modify system/framework/ framework-res.apk to remove “Roaming Indicator” chars:
(1) apktool d framework-res.apk
(2) Cd into framework-res/res,open strings.xml in “values”,” values-en-rUS”,” values-zh-rCN”,search for “roamingText1”,set value null,then save them.
(3) apktool b framework-res
(4) Replace miui_epic/system/framework/ framework-res.apk’s resources.arsc with framework-res/build/apk/resources.arsc.
13. The last step:cd into miui_epic,zip “kernel_update”,” META-INF” and ” system” to a zip file.You also can sign it(not have to).Then flash it!
Thanks:EpicCM team,xboxfanj and and many other contributors.
Click to expand...
Click to collapse
I started last night on making a GUI that will automate this process. Basically all that will need to be done is the downloading of a new version whenever it comes out. I'm thinking the baksmali/smali stuff will cause an issue, and might not be able to be automated, and if that's the case, then i will just do as much automation as i can.
One question though... is this the smali/baksmali tool everyone is using?
Death259 said:
I started last night on making a GUI that will automate this process. Basically all that will need to be done is the downloading of a new version whenever it comes out. I'm thinking the baksmali/smali stuff will cause an issue, and might not be able to be automated, and if that's the case, then i will just do as much automation as i can.
One question though... is this the smali/baksmali tool everyone is using?
Click to expand...
Click to collapse
That is correct
Sent from my Samsung Legen-wait for it-dary! 4g
bxfxf said:
My epic was lost,so I cannt continue to work for it.
Now i make a porting guide for you.You can continue to work for it based on the present build.It may need more additional works in the furture if the cm7 fixes others things.
1. Download miui_port_ns.zip and ns (or ns 4g,or others)miui rom from miui.us.
miui_port_ns.zip contains some files come from cm7 and EH17. What we need to do is that replace some files of miui.us latest rom with miui_port_ns's ones.
2. Extract miui_port_ns.zip to “miui_port_ns”.
3. Extract the ns(or ns 4g)miui rom to a new folder,then rename it “miui_epic”.
4. cd into “miui_epic”,delete all folders and files except “system” folder.(In the future,if our cm7 support mtd,you may need reserve some related files)
5. copy kernel_update/ and META-INF/ folders to “miui_epic”
6. cd into “miui_epic/system/vendor”
(1) delete bin/pvrsrvinit
(2) delete etc/
(3) cut and replace lib/ to system/lib/
7. cd into “miui_epic/system/lib”,delete egl/ and hw/ folders.
8. Cd into “miui_epic/system/app”,delete Nfc.apk and Tag.apk(nfc related).
9. Copy and replace “miui_port_ns/system/” to “miui_epic/system/”.
10. Modify build version in miui_epic/system/buid.prop.
11. Modify system/framework/ framework.jar to enable data:
(1) Smali framework.jar: apktool d framework.jar
(2) Copy and replace “miui_port_ns/framework.jar/com” to “framework.jar.out/smali/com”
(3) Baksmali framework.jar: apktool b framework.jar.out
(4) Copy and replace framework.jar.out/dist/ framework.jar to miui_epic/system/framework/
12. Modify system/framework/ framework-res.apk to remove “Roaming Indicator” chars:
(1) apktool d framework-res.apk
(2) Cd into framework-res/res,open strings.xml in “values”,” values-en-rUS”,” values-zh-rCN”,search for “roamingText1”,set value null,then save them.
(3) apktool b framework-res
(4) Replace miui_epic/system/framework/ framework-res.apk’s resources.arsc with framework-res/build/apk/resources.arsc.
13. The last step:cd into miui_epic,zip “kernel_update”,” META-INF” and ” system” to a zip file.You also can sign it(not have to).Then flash it!
Thanks:EpicCM team,xboxfanj and and many other contributors.
Click to expand...
Click to collapse
On step 11(1) you have to "Smali framework.jar: apktool d framework.jar" does this mean i need to do both, or i can i do one or the other?
Death259 said:
I started last night on making a GUI that will automate this process. Basically all that will need to be done is the downloading of a new version whenever it comes out. I'm thinking the baksmali/smali stuff will cause an issue, and might not be able to be automated, and if that's the case, then i will just do as much automation as i can.
One question though... is this the smali/baksmali tool everyone is using?
Click to expand...
Click to collapse
I use apktool, but both are probably fine. To answer ur question about step11, u have to baksmali first, then modify whatever he said to modify, then smali
Sent from my SPH-D700 using Tapatalk

A way to Optimizing APK & Framework files

For optimizing apks, aside from fixAllAPKs by omniwolf, I found another one.
Note: I have no responsibility for breaking your ROM, so backup first.
Rights: No rights reserved, you can do whatever you like.
The classes.dex files have significant amount of debug infos in it, striping out those can reduce file size and increase some performance. I test it with all /system/app/ and /system/framework/ files, the ROM runs snapier, especially when you launching apps. Stripe out those debug info doesn't hurt anything, they are usefull only for original developer and one who wants to mod it, but you can always keep a copy of the original one for modding and debugging purpose.
Note that this does not boost performance like increase CPU freq, but the theory is, since the file size is reduced, dex and dalvik-cache became smaller in size, occupies memories smaller, thus processing is faster, and saves a little battery life, you can think it as something like optipng does.
Note also, you don't need to specify 0 compression, dex will be decompressed to /data/dalvik-cache, just use fixAllAPKs for fixing files inside APK that should not be compressed, and 0 compression for file type like xml isn't really a good idea.
Don't use this for ICS Framework files yet, there are specific files will causes surprising bugs when recompiled, but I'm lazy to find it out why and what, so just don't do it.
For FixAllAPKs, original thread here, http://forum.xda-developers.com/showthread.php?t=1123463
or post #36 by carl1961 http://forum.xda-developers.com/showpost.php?p=21458549&postcount=36
==========================================================================================================
RemoveDebuggingInfo_v2.2:
API Level must be specified to get 100% compatibility, it seems not forward nor backward compatible.
Froyo = 8, GB = 10, ICS4.0 ~ 4.0.2 = 14, ICS 4.0.3 = 15
Added API Level chooser, default 15 (ICS 4.0.3)
Added more descriptions.
Correct typos.
==========================================================================================================
depricated...
RemoveDebuggingInfo_v2.1:
First, Thanks to all who corrects me.
fix typo for menu selection 6
fix path for pulling for adb to work without setting PATH env variable
fix pushing framework to wrong directory
update smali/baksmali to v1.3.2
update script to compile/decompile using api level 15
added menu selection of fixAllAPKs
Instructions: Important
The default config is for ICS 4.03 base ROM, if you are gonna use it for Gingerbread Base ROM, need to edit the file RemoveDebuggingInfo.bat, and change the -a 15 to -a 10 for API level 10, then just double click start.bat and follow the on screen instruction.
java -jar baksmali-1.3.2.jar -b -a 10 -o .\classes .\classes.dex
java -jar smali-1.3.2.jar -a 10 .\classes -o .\classes.dex
Click to expand...
Click to collapse
Using API level 10 for ICS and API level 15 for GB will not work, you phone will just hang or endless reboots.
Pushing framework will reset all your settings, so if you choose to push framework, do a factory reset instead and just re-install your user apps.
After pushing /system/app, you must reboot to recovery and wipe dalvik and cache, another way of pushing is boot to recovery, mount /system then push.
I have only tested on Gingerbread 2.08.401.1 base, have no idea for ICS, but it should work, as the latest smali/baksmali supports ICS.
If you experience glitches, do it from the beginning by using un-modified apk and jar.
How it works: it is just baksmali (decompile dex to smali code WITHOUT debugging info) and then smali (compile back to dex)
Requirements: java and htc sync usb driver.
==========================================================================================================
Depricated - too much error.
RemoveDebuggingInfo_v2:
Added another script for simpler operations, instead of dragging hundreds of APKs, it is self descriptive, can pull and push /system/app, /system/framework, optimizing all files for app and framework, and reboot to recovery.
Tested on v2.08.401.1 ROM, on all files /system/app, /system/framework, should work on other device and ROM too, but not sure, test it yourself!
==========================================================================================================
For /data/app/ user application files, modify it may not installed at all, re-sign it also not help, so just do it manually to test.
But for now, here is a way to do it manually, since /system partition will not grow and many spaces left, you can simply put some APP on this partition, and following are working on my ROM, some should have naming as com.a.b.c... whatever is the name installed on /data/app/ stripe out the -1 at the end. Just besure the APP is uninstalled before pushing to /system/app/
Below are what I tested.
AdobePhotoshopExpress.apk
BarcodeScanner.apk
com.evernote.skitch.apk
ESFileExplorer.apk
GoogleDocs.apk
GoogleGoggles.apk
GoogleTranslate.apk
GPSTest.apk
org.hermit.audalyzer.apk
For APKs that has lib folder, you can just extract it and put it on /system/lib/ then del the lib folder inside the apk archive, e.g. flashplayer, adobereader.
adb should be start only once after booting your PC, if you get issues, like adb always shows restarting and out of date, it is because the included adb.exe in htc sync is out of date, and you had installed android sdk with environmental variable set, to fix it, both must have same version, or simply delete one of them, and if you have path variable set, you can del the included adb.exe as well.
Thanks for this, I will be sure to use it
Sent from my HTC Sensation XE with Beats Audio Z715e using xda premium
I have 189 Apps in system/app .... is there a way to make it with all files!?
Jonny said:
Thanks for this, I will be sure to use it
Just out of interest, what program do you use for getting the smali code?
Click to expand...
Click to collapse
It is the one and only, baksmali.jar and smali.jar http://code.google.com/p/smali/
xtcislove said:
I have 189 Apps in system/app .... is there a way to make it with all files!?
Click to expand...
Click to collapse
Yes I know it is so much, but need to write a sohphisticated code, maybe if I have time, I'll try to make it more easier, a vbscript or cmd script, or a shell script in linux. And don't forget the framework files too.
mudhi said:
I test it with all /system/app/ and /system/framework/ files, the ROM runs snapier, especially when you launching apps.
Click to expand...
Click to collapse
It is really so. I have checked it up.
mudhi said:
It is the one and only, baksmali.jar and smali.jar http://code.google.com/p/smali/
Click to expand...
Click to collapse
Thank you mudhi
a little off topic here, Is there a way to change smali files into a readable code (let's say i want to use it with eclipse !!)
i have tried searching and i came across Dex2Jar and jd-gui !!
my question here is: is there a way to use smali files into Eclipse ??
Alfaifi said:
Thank you mudhi
a little off topic here, Is there a way to change smali files into a readable code (let's say i want to use it with eclipse !!)
i have tried searching and i came across Dex2Jar and jd-gui !!
my question here is: is there a way to use smali files into Eclipse ??
Click to expand...
Click to collapse
Yes, use dex2jar to jar archive file, then jd-gui to view the source, you can also use DJ-decompiler (commercial) to view and change code, but that's not really readable, and compile back is too hard, and also jbe, ce etc... but I came to a conclusion.
Use dex2jar to decompile dex and use jd-gui to view the source for understand logic, method etc... and just reference it to smali code, and if you get use to it, hacking app will be easier, perhaps more easier than viewing the source code, because hackiing involviing mostly on 0 to 1, true to false, jump to where ... and that is only adding or changing a single code in smali, e.g. logic if a == b then c, if you want to make it always c, then just if 0 == 0 then c, or just a simple jump etc...
@mudhi new smali/baksmali 1.3.2 is out
And is also possible to remove debugging info from jar files that are present in framework folder?
texture said:
And is also possible to remove debugging info from jar files that are present in framework folder?
Click to expand...
Click to collapse
I think you can just rename them to .apk and then back to .jar.
mike1986. said:
I think you can just rename them to .apk and then back to .jar.
Click to expand...
Click to collapse
No you dont need to, just put(or pull) all framework files (both apks and jars) and it will process them all automatically.
Btw i just ran this on InsertCoin 4.1.1 for all APPS and Framework except i changed a script a bit (added -mx0) so it compresses APKS with 0 compression.
And can tell you that phone definitively feels faster, boots faster, apps open faster, and there a bit more free RAM available now.
Thank you mudhi allot for this!
mike1986. said:
@mudhi new smali/baksmali 1.3.2 is out
Click to expand...
Click to collapse
ah... hehe thank you, supposed ICS 4.0.3 is supported. Thank you!
Need a little clarification ..
java -version
if errorlevel 1 goto javaerr
---------------------
C:\>java -version
'java' is not recognized as an internal or external command,
operable program or batch file.
---------------------
I installed java however still get an error ..
What is needed > to install ? Link Maybe ?
Also ... I found a small ops in the bat file ..
:javaerr
cls
echo Java is not found, please install java and rerun the script.
echo Hit anykey to quit
PAUSE
goto end < forgot this ?
Thanks ..
WarlockW said:
Need a little clarification ..
java -version
if errorlevel 1 goto javaerr
---------------------
C:\>java -version
'java' is not recognized as an internal or external command,
operable program or batch file.
---------------------
I installed java however still get an error ..
What is needed > to install ? Link Maybe ?
Also ... I found a small ops in the bat file ..
:javaerr
cls
echo Java is not found, please install java and rerun the script.
echo Hit anykey to quit
PAUSE
goto end < forgot this ?
Thanks ..
Click to expand...
Click to collapse
You need to set java variable, here's how-to:
http://java.com/en/download/help/path.xml
mudhi, You've got few errors in start.bat file. If you want to pull the apps to "app" folder, use this command "adb pull /system/app/ app". If you do cd app, It won't find the adb in the app folder and won't do nothing.
ivicask said:
No you dont need to, just put(or pull) all framework files (both apks and jars) and it will process them all automatically.
Btw i just ran this on InsertCoin 4.1.1 for all APPS and Framework except i changed a script a bit (added -mx0) so it compresses APKS with 0 compression.
And can tell you that phone definitively feels faster, boots faster, apps open faster, and there a bit more free RAM available now.
Thank you mudhi allot for this!
Click to expand...
Click to collapse
Before optimizing with this script, my apks are all fixed with the vbscript by omniwolf, it only compress files that should be compressed, the script fixAllAPKs.vbs can be used before or after this. Anyway, I'll add a decision to run the script.
mudhi said:
Before optimizing with this script, my apks are all fixed with the vbscript by omniwolf, it only compress files that should be compressed, the script fixAllAPKs.vbs can be used before or after this. Anyway, I'll add a decision to run the script.
Click to expand...
Click to collapse
Is there any problem with doing 0 compression on all files? I dont have space problems, and doesnt that make phone run faster as it doesnt need to decompress any data? Saves both CPU and RAM?
drms12 said:
mudhi, You've got few errors in start.bat file. If you want to pull the apps to "app" folder, use this command "adb pull /system/app/ app". If you do cd app, It won't find the adb in the app folder and won't do nothing.
Click to expand...
Click to collapse
Oh yes, I know where's the error, because I have android sdk installed and environmental PATH variable are set, you can fix it by just set the PATH variable with where the adb.exe exist.
Or just change the script with this
ullapp
cd app
../adb pull /system/app/
or
ullapp
adb pull /system/app/ app
same as pullframe
mudhi said:
Oh yes, I know where's the error, because I have android sdk installed and environmental PATH variable are set, you can fix it by just set the PATH variable with where the adb.exe exist.
Or just change the script with this
ullapp
cd app
../adb pull /system/app/
or
ullapp
adb pull /system/app/ app
same as pullframe
Click to expand...
Click to collapse
Yes
I think you forgot to update the download, It still ver2.
There is an error in script - the push command to upload files to framework uploads them to /system/app
ICS 4.0.3 - got bootloop just after lockscreen shows. Had to restore system.

How to re-odex?

Normally to decompile my dex files I use smali and baksmali, how can I re-odex them?
Id like to get my service.jar re-odexed so I can try and push it to my phone via a zip update.
Sent from my MB865 using xda premium
[mini HOW-TO] Re-Odex (or create a new .odex file)
Fall of Enosis said:
Normally to decompile my dex files I use smali and baksmali, how can I re-odex them?
Id like to get my service.jar re-odexed so I can try and push it to my phone via a zip update.
Sent from my MB865 using xda premium
Click to expand...
Click to collapse
It all needs to be done on your phone, live.. with adb.
Here's how I accomplished it - I will use the services.jar in this example. Just change the file name and path to existing .odex accordingly for other files (not sure if all steps are required exactly, but it has worked for me multiple times with different jars and SysUI apk):
Requirements:
Odexed system
adb
dexopt-wrapper
Put this dexopt-wrapper file (unzip first) in /system/bin with 775 permissions:
X X X
X....X
X....X
Probably a good idea to reboot after pushing that file, if you use root explorer (like I did).
Put the deodexed services.jar (or other jar/apk file you want to make an new odex of) on your sd card.
Go to /system folder (with root explorer or equal) and mount it R/W (not sure if this is necessary - but won't hurt)
Put your USB connection to "Charge only" mode.
Go here (big props and credit to jhotmann for this) and follow steps 8-12 (I've recreated the steps with the A2's bootclasspath below).
The bootclass path is located in the /init.rc file at the root of your phone.
Connect with adb (do a adb devices check to make sure you're all good).
To create the new odex:
Code:
adb shell
su
cd /sdcard/
dexopt-wrapper services.jar new.odex /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar:/system/framework/com.motorola.android.frameworks.jar:/system/framework/com.motorola.android.widget.jar
I know it's a long entry for those who don't work with command lines often (like me), but double check your entry before hitting enter.
To copy the signature from the existing odex (change path to /system/app/.. if necessary):
Code:
busybox dd if=/system/framework/services.odex of=new.odex bs=1 count=20 skip=52 seek=52 conv=notrunc
Done! Rename new.odex (created on your /sdcard) to services.odex since that is your new signed odex file...
You can then get that on your odexed system by your choice of method (adb push, update.zip, root explorer push, etc.. - note: please know what you are doing before trying to push files with root explorer! - you cannot simply copy and paste!)
Or, if you want to deodex it right away again for some odd reason like I did (personal issues )... Take the services.jar and the new services.odex from your sdcard and put them on your computer - and open the services.jar with 7-zip (maybe winzip) and delete the classes.dex file from the 7-zip window. Now you have a fresh new set of .jar/.odex files ready for deodexing (I did this all with the SystemUI.apk last night, that's why I elaborated and re-typed this whole thing today..).
Frigging brilliant man.
Much appreciated. I'm super sick and my USB cable is at work.
Once i get it back on Wednesday, I'll work all this out. If I could thank you twice I would.
Thanks man!
Sent from my MB865 using xda premium
Fall of Enosis said:
Frigging brilliant man.
Much appreciated. I'm super sick and my USB cable is at work.
Once i get it back on Wednesday, I'll work all this out. If I could thank you twice I would.
Thanks man!
Sent from my MB865 using xda premium
Click to expand...
Click to collapse
Not a prob.
And, I updated the dexopt-wrapper link so it's easier to download - just unzip it first..
Good luck on your quest.. let me know if you catch any snags along the way - and i'll try and help you out.
Sent from my mind using XDA
Ok sooo, I think we (or most likely me) are confused on what I wanted to do. I don't want to make a NEW odex file. I need to recombine my modded classes.dex BACK with the service.jar.
Since I needed to modify some script in the services.jar I had to de-odex it so I had a classes.dex file to use baksmali with so I could modify it. Once I modded it I used smali to create the NEW MODDED classes.dex. And now I need to re-odex(bad terminology?) them to re-combine the services.jar with the classes.dex so the modded services.jar could be used on a odexed ROM.
I'm working on a de-odexed version also, but I'd like to be able to offer both
Fall of Enosis said:
Ok sooo, I think we (or most likely me) are confused on what I wanted to do. I don't want to make a NEW odex file. I need to recombine my modded classes.dex BACK with the service.jar.
Since I needed to modify some script in the services.jar I had to de-odex it so I had a classes.dex file to use baksmali with so I could modify it. Once I modded it I used smali to create the NEW MODDED classes.dex. And now I need to re-odex(bad terminology?) them to re-combine the services.jar with the classes.dex so the modded services.jar could be used on a odexed ROM.
I'm working on a de-odexed version also, but I'd like to be able to offer both
Click to expand...
Click to collapse
So, you have a deodexed services.jar (with an unedited classes.dex inside)? And, you also have an edited classes.dex (the new modded one). Just drag and drop the new modded classes.dex into the services.jar file with 7-zip to overwrite the old one.
Then I would check out the mods on a deodexed system, and provided they work, then go through the re-odexing process (separating that classes.dex from the apk and creating a new odex file) as described above to get it working on odexed systems.
Hope that helps.. Good luck!
Yes sir, you are correct. That was the first thing I tried to do was just drag and drop the modded classes.dex with 7zip, save it, however when i tried to flash the "modded" ROM it can't install the system folder because (according to Jim), when I modded copied the new classes.dex, I changed the size, and so the signature needed to be changed as well. They mismatched.
Fall of Enosis said:
Yes sir, you are correct. That was the first thing I tried to do was just drag and drop the modded classes.dex with 7zip, save it, however when i tried to flash the "modded" ROM it can't install the system folder because (according to Jim), when I modded copied the new classes.dex, I changed the size, and so the signature needed to be changed as well. They mismatched.
Click to expand...
Click to collapse
Not sure about the details of that.. I know the signatures can be tricky, but I've modded a few apks/jars similarly with no problems... when you say "can't install.." is that it wouldn't flash in recovery, or you bootlooped?
Just wouldn't flash at all.
And thanks for all your help man.
Sent from my MB865 using xda premium
I've updated the 2nd post with more detail on creating a new odex file...
Not to be a "rooster" (replace with your word of choice) or anything, but maybe this info has a place somewhere besides the general threads..?:angel: (and what is up with these new Smilies and posting reply layout?) - it just seems so hard to come by good literature on this process (which, I suppose, is a process so rarely needed though...)
So I need to perform the processes above while running in an odexed environment correct? Does this process change the deodexed APK we are running the script on to an odexed one as well as create a new .odex file for that APK? I am just confused about what the result is after running the script. For my situation I want to take 2 deodexed files (systemui and sec settings.apk) and odex them. Then push them into an odexed rom. Once I run the script above what am I left with?
Didact74 said:
So I need to perform the processes above while running in an odexed environment correct?
YES.
Does this process change the deodexed APK we are running the script on to an odexed one as well as create a new .odex file for that APK?
(Yes, it will create a new odex file that you will need to rename, but..)NO. You will need to take the classes.dex out of the deodexed apk/jar - use something like 7-zip. Unless you only edited smali, then you really only need the new odex file.
I am just confused about what the result is after running the script. For my situation I want to take 2 deodexed files (systemui and sec settings.apk) and odex them. Then push them into an odexed rom. Once I run the script above what am I left with?
Click to expand...
Click to collapse
I broke up your quote with my best answers...
As for what your're left with is a new.odex file, properly signed, if all goes well. You are going to need to do it for each of your deodexed files.
Rename them, remove the classes.dex from the deodexed files you used, and get them on your phone however you choose (I prefer zip packages and a restore.zip in case something goes wrong).
Also note that the bootclass path is different from GB to ICS.. and among different devices of course. Check init.rc file if need be. I posted the one to use for A2 ICS (think it may be the same for razr too) here: http://forum.xda-developers.com/showthread.php?t=1753659
I can't garuntee you won't have problems, but good luck... if you do you could try the dexopt-wrapper from here: http://forum.xda-developers.com/showthread.php?t=1645950 - just unzip it first obviously (but I think it's the exact same file though..)
Btw, it's all done with adb, one line at a time.. not really a script, but thank you for the idea - maybe a batch file?
Sent from my phone's mind
Great, thank you for the detailed response. Last question.
What if I have the original SystenUI.odex and SecSettings.odex files that used to be attributed to them before i deodexed them? Can I simply reuse those without having to run through the adb process?
Thanks,
Didact74 said:
Great, thank you for the detailed response. Last question.
What if I have the original SystenUI.odex and SecSettings.odex files that used to be attributed to them before i deodexed them? Can I simply reuse those without having to run through the adb process?
Thanks,
Click to expand...
Click to collapse
But, you deodexed them to edit the smali files in the classes.dex right? So, no, you will need to use the new odex files that are created from the modded deodexed files you used..
If you never edited any of the smali files, then you didn't need to deodex in the first place... you only need to deodex in order to mod the smali files - everything else in the apk can be modded as is on odexed systems.
Sent from my phone's mind
Thank you very much. Can you repost the wrapper file? Its not downloading correctly.
Didact74 said:
Thank you very much. Can you repost the wrapper file? Its not downloading correctly.
Click to expand...
Click to collapse
Updated the link in Post #2 with a zip file - you need to unzip it first then move it.
Thank you.
So I am getting an error trying to re-odex. See the attached image of the error.
Weird thing is that even though I get an error it still creates the new.odex file. I triedto go through the entire process even though I was getting errors and it just got stuck on the boot screen and never loaded. Anything in my error attached raise any flags?
Thanks,
Didact74 said:
Thank you.
So I am getting an error trying to re-odex. See the attached image of the error.
Weird thing is that even though I get an error it still creates the new.odex file. I triedto go through the entire process even though I was getting errors and it just got stuck on the boot screen and never loaded. Anything in my error attached raise any flags?
Thanks,
Click to expand...
Click to collapse
Hmmm... First thing I can think of is: are all of those framework files in the bootclass path that you used actually in your /framework folder? With our A2, in ICS there are a few extra .jar files listed that were not actually on our phone, so I had to remove those from the path...
I will try to make a new odex myself and make sure that's not a standard error message... @Fall of Enosis, you recall what it spits out?
EDIT: Shoot - forgot I'm deodexed right now... will attempt later or hear back from Fall by then..
alteredlikeness said:
Hmmm... First thing I can think of is: are all of those framework files in the bootclass path that you used actually in your /framework folder? With our A2, in ICS there are a few extra .jar files listed that were not actually on our phone, so I had to remove those from the path...
I will try to make a new odex myself and make sure that's not a standard error message... @Fall of Enosis, you recall what it spits out?
EDIT: Shoot - forgot I'm deodexed right now... will attempt later or hear back from Fall by then..
Click to expand...
Click to collapse
Yes, all .jar files listed in my bootclass were located in the framework directory.
Nevermind...my mistake. I had an issue with my files not being deodexed correctly from the start. I went back and deodexed, made the edits to res and smali then odexed using the method above again and all went well!
Thanks!

[Q] Different method to edit an Apk: differences?

Hi to all! What are the differences between this:
Rename the *.apk to *.zip
Extract the *.zip file
Edit whatever you want
Compress all files again
Rename the *.zip to *.apk
and this:
Download ApkTool and "install" it
Using CMD navigate to the *.apk folder
Use this command "apktool d app_u_want_edit.apk"
Edit whatever you want
Use this command "apktool b app_u_want_edit"
???
Thanks in advance.
apktool
Francoiky said:
Use this command "apktool d app_u_want_edit.apk"
Edit whatever you want
Use this command "apktool b app_u_want_edit"
Click to expand...
Click to collapse
.
Using apktool be more change.
Normally you do not make changes to the file classes.dex and resources.arsc included in the APK files.
.
ze7zez said:
.
Using apktool be more change.
Normally you do not make changes to the file classes.dex and resources.arsc included in the APK files.
.
Click to expand...
Click to collapse
So, if I would change graphics only I could simply unzip and zip again, right?
As long as they are not .9.pngs then this will work but it will only work for images. I would advice learning apktool as this is the proper way to do it and you have less chances of messing something up. Alot of images are indexed and if not done properly can lead you to a boot loop
Sent from the Bat Cave

How to guide decompiling/compiling systemUI.apk

If you are not having problems compiling SystemUI.apk with no problems then this is not for you
WARNING:
You should not attempt to do this on a device that does not have a recovery, because if something goes wrong you may have to reinstall your rom (not very likely though). You should probably back up SystemUI.apk You should also have some experience modding and some experience using Apktool and Linux.
INTRO:
If your having problems modding SystemUI.apk on JB then this thread is just for you. I recently found out how to mod the Jelly Bean SystemUI. Jelly Bean has made it very difficult to mod. Yes it is still easy to replace images, but if you want to do some major changes to the UI such as a 100 percent battery mod or changing the status bar color then you will need to know exactly how to do it. For example, if you get the UI decompiled without errors and you recompile it without errors YOUR RECOMPILED SystemUI.apk WILL NOT WORK and your status bar will disappear etc... There is a special way to get everything working and I will show you how.
STEP 1:
LINUX>>
Before we start I recommend that you have File Roller: one of the most popular archive managers for Linux (Ubuntu comes with it). If your distribution uses a Debian package manager (most popular ones do) then all you have to do is go into the terminal and type:
Code:
sudo apt-get install file-roller
Now you will have File Roller. You also will need java installed. Check if you have java by typing:
Code:
java
in the terminal. If you dont have java and your using a Debian package manager then type:
Code:
sudo apt-get install openjdk-6-jre
or download from the java website and install it.
WINDOWS>>
Before we start, you will need 7zip and java. Just search and you will find the programs to install
STEP 2:
Now we will install APKTOOL. You may already have it installed BUT your version will probably not work. I have ran around the internet for a modified apktool that wont give you errors (If you follow my directions). I came across a great thread. check it out and download all the tools their (dont forget aapt) http://forum.xda-developers.com/show....php?t=1755243. If you are in Linux rename the jar file to apktool.jar and move the the jar plus aapt to /usr/local/bin. You will need root. If you are in Windows rename the jar to apktool.jar and move it and aapt to your WINDOWS directory. You also need zipalign http://powerpoint45.webs.com/android/zipalign(I think this one is only for linux so if ur on windows either test this one or get zipalign from android sdk)move it to your WINDOWS dir/bin dir. You need one more thing. It is from the apktool websitehttp://code.google.com/p/android-apktool/. According to your os download either apktool-install-linux-r04-brut1.tar.bz2 or apktool-install-windows-r04-brut1.tar.bz2. Extract the contents. You only need one file from the archive. In linux move apktool (not apktool.jar) to /usr/local/bin. In Windows move apktool.bat to your WINDOWS directory. Dont jump ahead and say "Now that I got apktool set up, I know what to do", because it gets a lot more difficult than you are used to using apktool.
STEP 3:
Now that you have apktool set up, you need to know how to mod SystemUI.apk. Get SystemUI.apk from /system/app within your device onto the computer. Now make a backup of SystemUI.apk on your computer because we will NEED it later. So you need two SystemUI.apk files on your computer. You could name one “backup” if you'd like. So now now we need to decompile the apk. Go into the terminal/cmd and cd/chdir into the directory you have SystemUI.apk. Now type
Code:
apktool if SystemUI.apk
It will then install frameworkneeded.Then type:
Code:
apktool d SystemUI.apk
It will decompile the apk. It will take a bit of time for it to fully decompile. The decompiled code will be in a folder in your current directory called SystemUI. If It had errors decompiling, (IT WILL FOR MOST NEXTUS 7 ROMS) you will need to install framework manually. Download framework here:http://db.tt/Rpc6zskQ and place the two APK files into apktool framework folder (replace the old framework files). In Linux it is located at /home/yourusername/apktool/framework and in windows it is something like C:\\Documents And Settings\yourusername\apktool\framework. After that delete the SystemUI folder that was made by the bad decompiling proccess and repeat the decompile command.
STEP 4:
This is the part where you start modding. You can make many customizations to the UI this way as you probably know. I will just show you how to make a 100 percent battery mod. You need to go into the decompile folder (SystemUI) using a file manager, Then from SystemUI, go delete res/drawable/stat_sys_battery.xml and replace it with http://powerpoint45.webs.com/android...ys_battery.xml (to download that file right click on link and click something like "save link as"). Now you need to move to a new directory: /res. In that folder you need to look through all the directories that start with the word drawable. For example drawable-mdpi. There is one directory that your device uses for images but you may not know which one. Your device might be MDPI but use drawable-sw600dp from the UI instead of drawable-mdpi. So if you dont know or you want to be safe then search through the drawable folders and if their are any battery icons then remember you will need to add 100 battery icons to each one of the folders with battery icons. The battery icons are the ones named something like stat_sys_battery_0.png. So if you need to add 100 icons they need to be named in numerical order from stat_sys_battery_0.png to stat_sys_battery_100.png. Dont worry though, you wont need to rename 100 icons. Their ar many battery mods online that you can get them from, but I have some images you can download: http://powerpoint45.webs.com/android...RY_BLUE.tar.gz. Download it, extract it and copy all the images into all the drawable folders that contain battery icons. Now your ready for compiling; The step that is different than how we have always done it before Jelly Bean existed. keep in mind that some images can not be changed or edited at all durring this step because it will result with many errors durring compiling. You would have to add images to the archive after its compiled
STEP 5:
Like I said at the end of step 4, this step will be different than you have seen before. This is also the step where you will be using File Roller/7zip. To build the apk make sure you are in the terminal in the directory where SystemUI exists and type:
Code:
apktool b SystemUI almostdone.apk
almostdone.apk is the output file. Once it is done building you need to open the backup apk you made at the beginning with File Roller /7zip. Also open almostdone.apk with File Roller/7zip. From inside the backup.apk drag meta-inf folder & androidmanifest.xml to allmostdone.apk. Now all you need to do is zipalign the apk. Lets say your backup apk is named backup.apk. Go into the terminal at the directory you are working
in and type
Code:
zipalign -v 4 allmostdone.apk done.apk
This will optimize the apk. The output is done.apk.
STEP6:
Now you install the apk. Their are many meathods of installing the apk, here are a couple. Transfer done.apk to your device and rename it to SystemUI.apk. Now use a root browser or terminal app to replace the other SystemUI.apk on your system at /system/app. And make sure you give it the same permissions as all the other apk's in the system/app directory. Then reboot. Or you could make a flashable zip to install it.

Categories

Resources