(GUIDE) How to use Apktool Apk manager Baksmali and Adb - Samsung Galaxy Fit GT 5670

Hello Guys....
Just been watchin around our forum and The Galaxy Fit Development Group in FB and came to know that many are not able to decompile, compile, using apktool and apk manager !!! And few are not able to use the baksmali tool and even Android debugging bridge (ADB) So Decided to make a Guide on How to use all these
The tools required are attached along with this file...
So here we go....
[How To Use APK Tool]
If you're using apktool for the first time thn
Place framework-res.apk and twframework-res.apk from STOCK Firmwares (Do not take it from Custom ROM )
Thn open command prompt in the current window and type the following code
Code:
apktool if framework-res.apk
apktool if twframework-res.apk
The Dependencies would be installed in apktool folder in C:\Users\USER NAME\apktool\framework and also check if u hav 1.apk and 2.apk present inside the folder
Decompile And Compile Apk's Using apktool
Place the apk file that u wish to decompile in the downloaded apktool folder
Open command prompt in the current window and type the following code
Code:
[To Decompile] apktool d "apk name.apk"
[To Recompile] apktool b "apk name"
Example:
Code:
[To Decompile Mms.apk] apktool d Mms.apk
[To Recompile Mms.apk] apktool b Mms
The Compiled apk would be in "dist folder" inside the "decompiled folder"
[How To Use APK Manager]
Always use apktool to install dependencies even if u r gonna use apk manager
Place the apk tat u wish to decompile in "Place here for modding folder"
Open Script.bat in the folder and Press 9 to decompile and 11 to recompile
The decompiled folder would be in "Projects" folder and recompiled apk would be in "place here for modding folder"
[How To Use Baksmali]
Smali/Baksmali is an assembler/disassembler for the dex format used by Dalvik
The names "smali" and "baksmali" are the Icelandic equivalents of "assembler" and "disassembler" respectively
Smali Editting can be done through apk tool as well as apk manager but all those needs experience and practice
Place either the .apk or .jar file who's dex u want to decompile in that baksmali folder
Right click and Edit 1.bat using notepad++
Code:
java -jar baksmali.jar -x "filename"."file extension" -o classout
Example:
Code:
[To Decompile Mms.apk] java -jar baksmali.jar -x [B]Mms.apk[/B] -o classout
[To Decompile android.policy.jar] java -jar baksmali.jar -x [B]android.policy.jar[/B] -o classout
U would get a folder called classout
Make necessary changes and to compile back just press 2.bat
U would get classes.dex in the current folder
Replace this classes.dex with the classes.dex in the unmodded file
[How To Use ADB]
Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device
With this adb u would be able to push pull files from your mobile, Logcat and much more
I would explain only the basic that is used most often that is pullin and pushin of files
Place the file tat u r about to push into the ADB folder
Code:
[To Push system apps] adb push "[B]apk name".apk [/B]/system/[B]app[/B]/[B]"apk name".apk[/B]
[To Push system framework files] adb push [B]"name".jar[/B]/system/[B]framework[/B]/[B]"name".jar[/B]
[To Push files to your SD Card] adb push [B]"filename.extension"[/B] /sdcard/
Example:
Code:
[To Push Mms.apk] adb push Mms.apk /system/app/Mms.apk
[To Push android.policy.jar] adb push android.policy.jar /system/framework/android.policy.jar
[To Push files to your SD Card] adb push Readme.txt /sdcard/
Credits:
Google
And to all those who taught me [How To Use These]
Tools

Reserved

Rooting
Sorry, I know this is not the right thread to post this..
But i need help
I am a newbie and never had rooted my android phone... I know that there had been many threads about rooting this phone..but i am a little afraid about bricking my phone..that's why i am asking again..
The specs of my phone are given in the attachment...Please give a guide on rooting and unrooting my phone..

Akshit97 said:
Sorry, I know this is not the right thread to post this..
But i need help
I am a newbie and never had rooted my android phone... I know that there had been many threads about rooting this phone..but i am a little afraid about bricking my phone..that's why i am asking again..
The specs of my phone are given in the attachment...Please give a guide on rooting and unrooting my phone..
Click to expand...
Click to collapse
May be u should try using the search option next time...
but since u asked for it
http://forum.xda-developers.com/showthread.php?t=1606380

Really good guide mr.wilfred...
Want to ask something about compile and decompile apk from ICS version... what tool I need to compile and decompile it? And which version?
Thank you....
Sent from my GT-S5670 using Tapatalk 2

AldoSebastian said:
Really good guide mr.wilfred...
Want to ask something about compile and decompile apk from ICS version... what tool I need to compile and decompile it? And which version?
Thank you....
Sent from my GT-S5670 using Tapatalk 2
Click to expand...
Click to collapse
A seperate version of Apk tool has been made and i saw it few days back in xda only.... I would let u know if i get that link... ^_^

http://www.xda-developers.com/android/modified-apktool-for-android-4-0-4/
this is the one for ics apks

unable to compile using your method

Avilove.Cullen said:
unable to compile using your method
Click to expand...
Click to collapse
which are u talking abt.......apks dexes or jar files........

Avilove.Cullen said:
unable to compile using your method
Click to expand...
Click to collapse
Thn u would hav done any error....
btw... wat was the error u got...

Avilove.Cullen said:
unable to compile using your method
Click to expand...
Click to collapse
Hey Avi from personal experience,.. I found out something none of these guides tell us !
U need to put a file called aapt in apkmultitools/platformtools/ for u to compile properly in some computers,..!
I had an error which read as
java.io.exception : cannot run command [aapt ....blah blah blah]
if this is the same error,.. just put the right aapt file,..
also,.. to mod JELLY BEAN apks,.. all u gotto do is put the latest aapt that u can download using Android SDK,..
Havent tested whether it works .. but saw that some did succesfylly decompile using this method (no not in xda,.. in some other forum,.. )

I did all this and I get a folder with all the this stuff in it with smali extentions. I was wondering how do you actually look at the code of the apk and program it self. The reason why I want to look at the code is to see apps are written; the best way I know how to is by looking at code and figuring it out.

brievolz84 said:
I did all this and I get a folder with all the this stuff in it with smali extentions. I was wondering how do you actually look at the code of the apk and program it self. The reason why I want to look at the code is to see apps are written; the best way I know how to is by looking at code and figuring it out.
Click to expand...
Click to collapse
FYI smali's are dalvik opcodes... u can use dex2jar to view the smali in java language which is easier wen compared to smali... and to under these languages u would hav to learn java or hav xperience and interest too

need a recommendation for APK Tool
Hi, I have a i9305 SG3 using a custom ROM Jellybean Ver 4.1. I want to learn how to decompile, edit, and recompile code in my SystemUI.apk file. I know I need an APK tool/manager of some sort. However, after looking through your thread (and looking into other research on google) I wasn't able to find conclusive evidence on WHAT the name of a stable APK Program is and WHERE to get it.
*
I am using Windows 7 64x PC and want to learn how to edit APKs. I have appreciated reading your threads and hope to learn more. I need to find the right APK software to start with. Suggestions please....

droido123 said:
Hi, I have a i9305 SG3 using a custom ROM Jellybean Ver 4.1. I want to learn how to decompile, edit, and recompile code in my SystemUI.apk file. I know I need an APK tool/manager of some sort. However, after looking through your thread (and looking into other research on google) I wasn't able to find conclusive evidence on WHAT the name of a stable APK Program is and WHERE to get it.
*
I am using Windows 7 64x PC and want to learn how to edit APKs. I have appreciated reading your threads and hope to learn more. I need to find the right APK software to start with. Suggestions please....
Click to expand...
Click to collapse
Hey there..... Hello..... U can either use apk manager or apk tool to decompile nd recompile apk's ... But as far as i know ICS rom's had different dependencies hence a diff version of apktool wer required .... since your rom being jelly bean ,As a wild guess, it MAY hav certain problems as such in ICS's ROM's ..... The best solution is either ask a fellow dev from your community who has been decompilin/recompilin apps or else there's always a better partner ( google ) .....
Sent from my GT-S5670 using XDA

Hey wilfred for decompiling app from custom rom like cm7 should we still use stock framework first??

MajinSaiyan4 said:
Hey wilfred for decompiling app from custom rom like cm7 should we still use stock framework first??
Click to expand...
Click to collapse
nop.... use CM7 framework-res.apk !!!

wilfredcool007 said:
nop.... use CM7 framework-res.apk !!!
Click to expand...
Click to collapse
Ok thnx but i had problems recompiling systemUI.apk with apktool even without any modifications sry cant post error right now im on phone..

MajinSaiyan4 said:
Ok thnx but i had problems recompiling systemUI.apk with apktool even without any modifications sry cant post error right now im on phone..
Click to expand...
Click to collapse
Did u delete the public.xml before u could recompile ??? if so u wouldnt hav got any error.... to be on the safer side send me the error tat u get....

wilfredcool007 said:
Did u delete the public.xml before u could recompile ??? if so u wouldnt hav got any error.... to be on the safer side send me the error tat u get....
Click to expand...
Click to collapse
Uh is it necessary to del public.xml??ok i wil try when im on pc..actually i was trying jellybean layout mod but i was unsuccesful

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

[HOW-TO] Decompile ICS and above apk and jar files MANUALLY

With the number of ICS ROMs that are popping out, I imagine the majority of people are spending their time on ICS rather than Gingerbread or Froyo. With that in mind, here's a little guide on how to decompile ICS .apk and .jar files (such as the troublesome SystemUI.apk) with ease so that you can mod them to your heart's content. I assume this method will work for other versions of Android as well. Just so we understand each other, this just helps you decompile the classes.dex. If you want to decompile an entire app or jar file there are other guides for that.
NOTE: We will NOT be using ApkTool, Apk Manager, or StudioAndroid to do this. Mainly because I have had trouble in the past using those applications to decompile certain files. So, here is an ALL MANUAL way.
What you need:
Deodexed .apk/.jar file
smali.jar
baksmali.jar
7zip or Betterzip (whether you are on Mac, Linux, or Windows)
terminal/cmd (depending on what you're running)
You can get the smali.jar and baksmali.jar files from here: http://code.google.com/p/smali/downloads/list
Download these files:
Code:
baksmali-1.3.3.jar
smali-1.3.3.jar
and rename them to:
Code:
baksmali.jar
smali.jar
Now that you have both files, place them somewhere you'll remember (like a folder on your Desktop). For the purposes of this guide, my files will be in .../Desktop/ICS
Ready? Okay, here we go.​
Open up your desired ICS .apk or .jar file with 7zip or Betterzip and extract the classes.dex and move it into the directory where you have baksmali.jar and smali.jar (For example, I move the classes.dex file to .../Desktop/ICS)
Open up terminal or cmd
cd to your directory
Example:
Code:
cd .../Desktop/ICS
Type the following:
Code:
java -jar baksmali.jar -o classout/ classes.dex
This will decompile the classes.dex file and create a folder inside .../Desktop/ICS called classout where all of your smali files will be located.
Go into the classout folder and make your smali edits
Compile your classout folder into new-classes.dex by typing this into terminal:
Code:
java -Xmx512M -jar smali.jar classout/ -o new-classes.dex
Rename new-classes.dex to classes.dex
Take your newly compiled classes.dex and put it into your ICS .apk or .jar using 7zip or Betterzip
Profit
Have fun :highfive:
Nice to have a write up on this in the Inc forums instead of having to hunt it down all the time. I've found it best to use smali and baksmali too, the apk aps were just too flaky for me.
kzoodroid said:
Nice to have a write up on this in the Inc forums instead of having to hunt it down all the time. I've found it best to use smali and baksmali too, the apk aps were just too flaky for me.
Click to expand...
Click to collapse
Yeah I've had similar experiences as well. This method was the only one that worked flawlessly for me. Hopefully it works for you and everyone else who needs to modify ICS files.
I've used it in GB to do some of the modifications to the status bar, like hide the clock. Took the better part of a day googling to actually find a write up on how to use baksmali and smali as I couldn't get apkTool or apkManager to decompile or compile classes.dex properly. Now I know where to find the instructions when I need them again.
thank you for this nice write up. It did really help me
Man you are just awesome for posting this, I have been googling how to decompile and recompile .apk's and .jar's for a couple of days and nothing has worked. This worked great the first time around and was very simple to follow. I just hope that once I am done making my editsI do not have any troubles re compiling the .jar I am working with lol.
You know it is so ironic that I found your guide here on XDA. It seems like everytime i want to learn how to do something like this I can google all day without much success on finding something that works. But when I do find something that works around 90% to 95% of the time it is here on XDA. You have got to love XDA...
T-Macgnolia said:
Man you are just awesome for posting this, I have been googling how to decompile and recompile .apk's and .jar's for a couple of days and nothing has worked. This worked great the first time around and was very simple to follow. I just hope that once I am done making my editsI do not have any troubles re compiling the .jar I am working with lol.
You know it is so ironic that I found your guide here on XDA. It seems like everytime i want to learn how to do something like this I can google all day without much success on finding something that works. But when I do find something that works around 90% to 95% of the time it is here on XDA. You have got to love XDA...
Click to expand...
Click to collapse
Yeah XDA does seem to be the go-to place for everything lol. Glad to know it worked for you
Note that you still need apktool in order to decompile/recompile XMLs and PNGs in apk files.
kong said:
Note that you still need apktool in order to decompile/recompile XMLs and PNGs in apk files.
Click to expand...
Click to collapse
Are there no other standalone command line tools for those tasks?
SifJar said:
Are there no other standalone command line tools for those tasks?
Click to expand...
Click to collapse
I would like to know that as well...
Wow, thank you very much. I'm going to have fun with this.
Sent from my Desire HD using xda premium
Thanks for the tutorial, I have successfully extracted the classes.dex but i cant seem to find where to add this code:http://forum.xda-developers.com/showpost.php?p=16485374&postcount=15 in the NotificationManagerService.smali file. I have even opened up a file that supposedly has the patch in it but could not locate it. A point in the right direction would be appreciated.
Great tutorial awesome work
Sent from my Galaxy Nexus using Tapatalk 2
i wan to edit samsungcamera.apk...
i can not find classes.dex inside this apk....
only got META_INF,res,AndroidManifes.xml and resources.arsc....
Have you decompiled it first?
Sent from my Galaxy Nexus using Tapatalk 2
Hey I made some changes in the AssetManager.smali and now I can't recompile. Getting this error Error: Unable to access jarfile smali.jar
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Cannot find file or directory "classout/"
at org.jf.smali.main.main(main.java:184)
didi1985 said:
i wan to edit samsungcamera.apk...
i can not find classes.dex inside this apk....
only got META_INF,res,AndroidManifes.xml and resources.arsc....
Click to expand...
Click to collapse
Is your rom deodexed?
Sent from my PantechP9070 using xda premium
Great guide easy to understand.
Thank you.
Reply To Thread
This is one of the best tutorial... Keep it up bro!
Help me, i can't edit .smali, because i don't understand smali,.
have any help?
like convet to java or any langgue ?

[Q] question about (de)compile...

I'm getting this issue:
I got Settings.apk and framework.apk from a rom, then i opened apktool and
1) imported fw: apktool if framework.apk
2) decompiled apk: apktool d Settings.apk
3)edited a string in a xml
4) rebuilt all: apktool b Settings Settings.apk
5)pushed it into system/app
6) fix permissions and reboot.
Settings now should work, but it doesnt. Can somebody tell me where i do a mistake?
Thank you
(I used win8, but i could use macos or ubuntu as well)
sign it first
ej8989 said:
sign it first
Click to expand...
Click to collapse
I did it. same result. maybe the application I used is not good (Auto-Sign v0.65). what application i've to use?
I didnt write it before, however the rom is on 4.2.1 (cyanogen 10.1)
put your re-complied apk to your phone's sd card and use zipsigner2 from playstore to sign it.
ej8989 said:
put your re-complied apk to your phone's sd card and use zipsigner2 from playstore to sign it.
Click to expand...
Click to collapse
Nothing. Maybe this is not good for 4.2.1? (I've used it lots of times with 4.1)
Well, apktool is using smali/baksmali to compile/decompile classes.dex/apk_name.odex file.
The problem can occur when you use different baksmali version when you decompile and also not the right version to compile (as the system expects it to be). You can also experience issues if the apk is not zipaligned properly (check down who to do that)
apktool has the smali/baksmali code inside it so you will need to get the newest version for it for JB for example.
You can check why the status bar is not there when you monitor the logcat and look for DEX related logs in the beginning.
You can also use smali/baksmali on your own: http://code.google.com/p/smali/wiki/DeodexInstructions
and just place the generated classes.dex in the apk
then zipalign -f 4 filein.apk fileout.apk (http://developer.android.com/tools/help/zipalign.html)
then push back fileout.apk (sytemui.apk in your case)
Sent from my Galaxy Nexus using xda premium

[How to] noobs guide to decompile/recompile android application

Guide to decompile android application
REQUIREMENT
Apktool [ http://www.mediafire.com/?ooaflvs6nvo5xvq ][Thanks to brut.all for this apktool]
Java JDK/JRE 32 bit [please google it guy's]
Little knowledge on cmd
__________________________________________________ __________________________________________________ _____________________
Preparation before WORKING
Process :-
1)now install the java in your pc/lappy
then copy the apktool.zip & goto directory C:/
make a folder name apktool (u can name it by watever u like)
now goto that folder & paste the zip
extract that zip there...
2) now copy the .apk or jar file which u wnt to decompile
& paste it on apktool folder.....
also copy the framework-res.apk of that rom &
paste it on that folder..
Decompiling application
3) now open cmd
Your cmd will probly look like this..
C:\users\yourname>
so type in
cd.. (yes include the '..' and press enter after you type each command)
this will get you to back directory so now you will see
C:\users>
so type again
cd..
you should now see this:
C:\>
now type
cd apktool (and you are in the apktool directory)
4)Installing Framework
Now that you are in directory we need to install the device's framework to your system for it to compile correctly so type this:
apktool if framework-res.apk
this will install the devices framework to your system (need to do this)
5)now to decompile the apk you want to edit.. type this:
apktool d music.apk mod
music.apk is the apk your decompiling
mod is the folder you're creating for the decompiled apk
do whatever you want to do with your apk...
NOW RECOMPILING
6)now to recompile your new apk type this:
apktool b mod music-new.apk
mod is the folder with your edited files
music-new.apk is your new apk file
Now we are NOT done... we cannot use the new apk's...
now make two separate folder a & b
copy-paste the original music.apk in 'a'
& music-new.apk in 'b'
use something like 7zip, take the 'resources.arcs' file and any other xml files you edited out of the "new-edited" apk and copy them into Original apk
now add to archive ...the origanl apk in zip format
& at the end of the file name .apk ( i mean give the file format name as .apk insted of .zip)
Now you are almost done..... :good: :good:
IF it is a system app then don't sign it....otherwise u have to sign that app....
That's all
don't forget to hit thanks or comment.... :good: :good:
Quick info: It doesn't work for chineese roms
lozohcum said:
Quick info: It doesn't work for chineese roms
Click to expand...
Click to collapse
is sony roms r chinese?!
Sent from my GT-S5360 using xda app-developers app
No but you can't use it for MIUI/Lewa porting, just saying
lozohcum said:
No but you can't use it for MIUI/Lewa porting, just saying
Click to expand...
Click to collapse
hmm its for gb,ics and jb based roms.. and its very simle guide :good:
ASK
Sorry Bro.. I am trying this method to decompile and recompile *.apk in system, but it say needed "twframework-res.apk" / 2.apk .. where i can get this file..? because there is nothing twframework-res.apk file in my phone...
thanks..
Java_Indo said:
twframework-res.apk
Click to expand...
Click to collapse
It is in system/framework
But be very careful
Because it may cause your handy not to boot
Regards
Naney said:
It is in system/framework
But be very careful
Because it may cause your handy not to boot
Regards
Click to expand...
Click to collapse
sorry , twframework-res.apk cannot found in framework folder,
btw do you have twframework-res.apk for tipo?
if ya, would u like to share with me...
thanks for your explanation.
Java_Indo said:
do you have twframework-res.apk for tipo?
Click to expand...
Click to collapse
Which ROM are you using?
Naney said:
Which ROM are you using?
Click to expand...
Click to collapse
sorry .. usually iam using JB ROM Cyanogen, but for now iam using MIUI v5 . ..
Java_Indo said:
do you have twframework-res.apk for tipo?
Click to expand...
Click to collapse
Here you are...

[Guide]Easy recompile decompile for noobs with mobile

Hi guys everyone here getting many problems while recompiling ics + apps so here is solution
u don't require java SDK like PC
Requirements - rooted mobile(any)
Sorry for repost maybe will usefull for thoose who doesnt have any PC but want to mod your young confirm worked on armv6 or galaxy y
Original threads
http://forum.xda-developers.com/showthread.php?t=2388135
[app]apktool.apk[share]
Hey all im here to share a tool its apktool.apk
Im not the creator of this app im just share it here all creddits belongs to the developer of this app and google
Ok how its works?
This tool are similiar with apktool on windows
U can decompile an apk recompile it and u can edit all the resources inside it
How to install?
Download the tool from here
http://code.google.com/p/apktool/
Im suggested u are downloading all arm version
Estract the package and put apktool folder on sdcard/here
And navigate to sdcard/apktool/install apktool.apk
Install and run
NOTE:THIS APP REQUIRED ROOT ACCESS
DISCLAIMER: THIS IS FREE OPEN SOURCES TOOL U CAN USE IT BUT USE WITH YOUR OWN RISK
NOTE2: IF U FACING ANY PROBLEM DUE DECOMPILING PROCESS OR RECOMPILING PROCESS PLEASE INSTALL UR FRAMEWORK U CAN FIND IT ON SDCARD/APKTOOL/FRAMEWORK/HERE CHANGE 1.APK WITH YOUR FRAMEWORK
How to install framework?
gB: copy frameworkres.apk and tw frameworkres.apk to sdcard(any folder but remmember the path)
Open apktool app navigate to framework and tw framework long press on it then choose import as enjoy
Ics/jb
Copy frameworkres.apk and navigate apktool app longpress on it then choose import as
CREDDIT:
DEVELOPER OF THIS APP(i dunno who its him)
Google
Atep sujana
Ogy
Evanlocked
original thread - http://forum.xda-developers.com/showthread.php?t=2408640
i need this,thanks!!!

Categories

Resources