How to extract source code of an .apk using ubuntu system.

How to extract source code from apk :

Requirements:

1. apktool1.5.1.jar download from here.

2. apktool-install-linux-r05-ibot  download from here.

3. dex2jar-0.0.9.15.zip download from here.

4. jd-gui-0.3.3.linux.i686.tar.gz  (java de-complier) download from here.

5. framework-res.apk ( Located at your android device /system/framework/)

Procedure:

1. Rename the <your_app>.apk file and change the extension to .zip ,

it will become <your_app>.zip.

2. Then extract <your_app>.zip.

3. Unzip downloaded dex2jar-0.0.9.15.zip file , copy the contents and paste it to unzip folder.

4. Open terminal and change directory to unzip  “dex2jar-0.0.9.15 “

– cd <path-to-folder>
– sh dex2jar.sh classes.dex (result of this command “classes.dex.dex2jar.jar” will be in your *extracted folder*  itself).

5. Now, create new folder and copy “classes.dex.dex2jar.jar” into it.

6. Unzip  “jd-gui-0.3.3.linux.i686.zip“ and open up the “Java Decompiler” in full screen mode.

7. Click on *open file* and select “classes.dex.dex2jar.jar” into the window.

8. “Java Decompiler” and go to file > save and save the source in a .zip file.

9.  Create “source_code” folder.

10. Extract the saved .zip and copy the contents to “source_code” folder.

11. This will be where we keep your source code.

12. Extract apktool1.5.1.tar.bz2 , you get *apktool.jar*

13. Now, unzip “apktool-install-linux-r05-ibot.zip”

14. Copy “framework-res.apk” , “<your_app>.apk” and  apktool.jar

15. Paste it to the unzip “apktool-install-linux-r05-ibot” folder (line no 13).

16. Then open terminal and type:

– cd <path to apktool-install-linux-r05-ibot>

– chown -R <username>:<username> ‘apktool.jar’

– chown -R <username>:<username> ‘apktool’

– chown -R <username>:<username> ‘aapt’

– sudo chmod +x ‘apktool.jar’

– sudo chmod +x ‘apktool’

– sudo chmod +x ‘aapt’

– sudo mv apktool.jar /usr/local/bin

– sudo mv apktool /usr/local/bin

– sudo mv aapt /usr/local/bin

– apktool if framework-res.apk

– apktool d <your_app>.apk

17. Now just copy the contents of the resulting folder( folder name will be your .apk files name)to “source_code” folder.

18. You can find out entire source code in “source_code” folder.

Flash Bada2.0 firmware to Samsang Wave II GT-S8530

Pre-requisites:

1. Your phone should have free memory as below:

  • 370MB of free “System” memory
  • 150MB of free “User” memory
  • 400MB of free “Applications” memory

2. Make sure your phone battery is at-least 90% charged.

3. Windows XP/Vista/2007 System.

4. microUSB cable.

Downloads:

1. Bada 2.0 Stock ROM firmware files , Download from here.

Note:  I have S4 Style TurkoCFW V10.1 S8530 by hero355&Frager  Stock ROM ,          but  you can use another Bada 2.0 Stock ROM of your own risk

2. MultiLoader V5.65 , Download from  here.

Flashing process :

1. Extract S4 Style TurkoCFW V10.1 S8530 by hero355&Frager.zip , and open folder S4 Style TurkoCFW V10.1 S8530 by hero355&Frager .(see below if all files are present)

extract_Turko

2. Open MultiLoader V5.65 by clicking MultiLoader V5.65.exe

full_downoad

3. Select all files from S4 Style TurkoCFW V10.1 S8530 by hero355&Frager , then drag and drop to your MultiLoader V5.65 ( MultiLoader V5.65 look like as below).

drag_drop4. Do not keep microSD card in your phone.

5. Go to Menu – Settings – Connectivity – USB utilities – Turn On Mass Storage.

6. Turn off your phone.

7. Go to Download Mode ( Press Volume up +Camera key +End call key).

Download_mode

8. Connect phone to PC using micoUSB cable.

9. Come back to  MultiLoader , click on Port Search.

10. Click on Downloads and wait until it flash all files ( you can see message in black box as below).

Downloads files

Downloads files

11. Disconnect microUSB cable .

12. Phone will boot up itself , it will display Samsung wave II GT-S8530 and start to do Configuration , wait untill it show Bada and you done with it .

Samsung_wave Configuration Bada_logo13. If require you can do language setting , data and time settings , and enjoy new Bada2 on your phone.

Dual OS (Bada 2 & Android 4.2.2 jellybean) in Samsung Wave II GT-S8530 without ExternalSD card.

Warning:

  • Please follow the steps at your own risk, this require rooting your phone, so it can void your phone’s warranty .
  • Follow the steps exactly, unable to do so can brick your phone and make it unusable(for life), it may slow down your device.
  • Before proceed please do read entire post carefully.

Prerequisites:

1. Your phone should have free memory as below:

  • 370MB of free “System” memory
  • 150MB of free “User” memory
  • 400MB of free “Applications” memory

2. Windows XP/Vista/7 System.

3. microUSB cable.

4. Bada 2.0 in your phone. (fresh devices).

5. Make sure your phone battery is at least 90% charged.

Downloads:

1.  Multiloader V5.65.exe  ,Download from here

2.  BOOTFILES files , Download from here

3.  armlinux_boot.fota (FOTA) , Download from here

4.  CyanogenMod (cm-10.1-wave-v2.1) , Download from here

5.  gapps-jb-20130301-signed.zip , Download from here.

Note:

1. If you have already BadaAndroid installed in your phone , then to remove it flash Bada 2 firmware (stock ROM).  To get only Bada 2 on your phone , you can see post **flash bada firmware to Samsang Wave II-GT8530 **   and  then continue to Steps to install BadaAndroid(JellyBean).

2. Please don’t put microSD card untill you complete installation process.

Steps to install BadaAndroid(JellyBean):

1. Connect phone to PC using micoUSB cable.

2. Go to Menu – Settings – Connectivity – USB utilities – Turn On Mass Storage.

3. Extract cm-10.1-wave-v2.1.zip file on our machine, Open it.

4. Copy zImage (kernel file) , paste it to Bada’s User partition.

5. Copy whole cm-10.1-wave-v2.1.zip , gapps-jb-20130301-signed.zip and paste it to Bada’s User partition.

6. Now , disconnect phone from PC , and switch off the phone.

Important : If you have already flash Bada2.0 using my post , then you no need to flash BOOTFILE, and FOTA file , just Skip 6-14 point go to 15

6. Go to Download Mode by pressing (End key + Camera key + Volume Up key).

Download_mode

7. Connect phone to PC using microUSB.

8. Open ‘Multiloader V5.65’ .

9. Check checkbox Full Download.

10. Extract BOOTFILES_S8530NELH2.zip  and drag and drop folder to Multiloader V5.65.

11. Extract  armlinux_boot_S8530NELH2.zip then drag and drop .fota file to Multiloader V5.65.

12. Click on ‘Port Search’ and ‘Download’ and wait till All files flashed.

13.  Phone will boot up itself  to Bada2.0.

Samsung_wave14. Disconnect phone from PC , and switch off the phone.

15. Go to Recovery mode by pressing key combination (end key + menu key  + volume up key ).

Note :  After pressing key combinations it will show you Red color FOTA message     and take you to BadaAndroid logo and then CWM_based recovery .

Photo0482

Photo0491 Photo048016. You will be able to see so many options there, to navigate through options use key combo as below

                            To go down – Volume down key

                           To come up – Volume up key

                           To select option – Menu key

17 . Go to second option –install zip pressing Volume down key.

18. Select it by pressing Menu key , then select  -choose zip from sdcard.

19. then Go down and select -cm-10.1-wave-v2.1.zip  then go to and select – Yes- Install cm-10.1-wave-v2.1.zip 

Note – installing updates and one logo will appear, let it complete , shows install from sdcard complete.

Photo0483 Photo048420. Now again go to -choose zip from sdcard , then go down and select – gapps-jb-…zip. Wait for a while till installation complete.

21. Now, Reboot phone by pressing (call key + end key) ,it will take you to Read Fota message , wait untill  badaAndroid logo appear on screen ,then you are there to Cynogenmod logo , and start  Android is upgrading , flashing to boot .. etc

Photo0492Now,  welcome to cynogenmode screen will appear , click next and so on …

Photo0488Important note: 

           Boot Bada2.0  pressing  End key

          Boot Android pressing Call key + End key, (you will get FOTA file message then badaAndroid logo , Cynogenmod logo)OR Call key + End key +Volume Down key.

Extra information:

1. You can remove installation .zip from the User partition from Android level by connecting through microUSB .
2. Do not remove zImage file and modem directory.

3. If remove zImage , you unable to start android as well as can’t go to Recovery mode    if you want it again then just copy paste zImage again and start.
4. Normal bootup is available using End Call keys
5. CWM Recovery mode is available using End Key + Menu key + Volume Up keys
6. CWM Flashing does overwrite zImage. So every next update you can just flash .zip through CWM.

How to remove CM10.1wave (badaAndroid):

Downloads:

1. Copy CM10Remove.zip , download from here.

Process:
1. Copy CM10Remove.zip to the Bada’s User partition.

2. Power off your phone.
3. Go to  to Recovery Mode(End Key + Menu key + Volume Up ).
CWM Recovery starts.
– install zip
– choose zip from sdcard
– CM10Remove.zip
– Yes – install
4. Reboot holding the End Key.

Note:

1. It removes CynogenMode , but won’t remove .zip files from your phone.

2. If you want badaAndroid on your phone then again install -cm-10.1-wave-v2.1.zip  ,install gapps-jb-…zip from recovery mode