[Desire Android Development] xavierjohn22:
xda AutoAPKTOOL

********************************************************

xda AutoAPKTOOL (xAAT)

CURRENT VERSION: 5.0.0b

********************************************************

LATEST DOWNLOAD: http://tweaksparadise.com/download/xavierjohn22/index.php?action=list&folder=2100

5th POST: MIUI smali hunting and images to be change + PSD sources

This tool has been tested MIUI XJ Rom HERE

Compile and Decompile APKS, Build language packs faster with many devices, N1, G7, Galaxy S, etc..

OBJECTIVE:

Main intention is to automate/batch processing decompiling and recompiling, flashable zip creation, etc

Initially made when translating miui apks and building lang pack

USAGE:

Run AutoAPKToolMain.bat

QUICK HOW TO:

THE 1-2-3-4 + 5 PROCESS

- Place ALL apks to decompile in _INPUT_APK folder

- Place the framework-res apk in the _INPUT_APK as well (filename: framework-res.apk)

- Choose 1 then hit enter for if framework-res.apk command

(note that framework-res.apk will always be in the _INPUT_APK folder)

- Choose 2 to decompile all in one shot

(this will create the resources and sources folder inside _INPUT_APK folder)

- Do your edits for all in that folder, add your values-en, values-pt, raw-en, etc.

You may add drawable-en-hdpi as well

Edit your strings.xml and many more...

Remember to keep the folder structure intact

After all edits are done

- Choose 3 and hit enter

This will recompile all in one shot

A notepad will appear to show if there are errors in recompiling, check the log

Adjust if necessary, you can choose to recompile a single folder if you need to

- Choose 4 to build usable APKs

All apks will be in the _OUT_APK folder (These will not FC)

All overwriting of files are automated

These APKs are from the Original apk with:

resource.arsc + classes.dex changed + other resources added

-Choose 5 (the fun part, lol)

It will build your flashable zip signed already, there's a template in the _FLASHABLES folder

You may edit it, replace it with the same name, just keep templates by renaming, place your build.prop there, etc

Read the text file thoroughly...

So that is the short story....

For other options and features read the ReadMeHistory.txt

FYI, read notes below (in _OUT_APKTOOL_DIST folder, those are build by APK Tool)

I manage to build APKs that don't FC in the _OUT_APKTOOL_DIST only that...... (see txt for complete explanation)

EXAMPLE 1: IMAGE

If you are overwriting an image in an APK (widget_1x.png)

_CUSTOM_RES

-MiuiMusic

--res

---drawable-hdpi

----widget_1x.png (this is the image i will overwrite)

Otherwise if you are adding folders no need to turn on "overwrite resources), put all your files in:

_INPUT_APK

-MiuiMusic

--res

---drawable-de-hdpi (this is the image folder i added)

----widget_1x.png

The Copy added resources "ON" will take care of copying these added resources or files

SOME EXAMPLES OF IMAGES AND FILES OVERRIDING:

"_CUSTOM_RES\AppShare\res\drawable-hdpi\installed.png"

"_CUSTOM_RES\Gallery\res\menu\media_context_menu.xml"

"_CUSTOM_RES\ThemeManager\res\drawable-hdpi\desktop_mask.png"

EXAMPLE 2: XML BINARY WHEN YOU DO DIRECT EDITS

Say you are editing a file straight from framework-res\res\drawable\progress_horizontal.xml

FOR NOW YOU HAVE TO DO THIS:

1) After doing [3], recompiling the apk

2) Copy the file _INPUT_APK\framework-res\build\apk\res\drawable\progress_horizontal.xml

to

_CUSTOM_RES\framework-res\res\drawable\progress_horizontal.xml

(this is the binary of your edited file, by doing this, you are telling the tool to overwrite it when building the apk)

3) Once this is done, make sure that "Overwrite res using _CUSTOM_RES" is ON, it is ON by default

4) then do build usable, It should overwrite those binaries in the APK

NOTES:

"Build Usable APKs" perform these depending on options

- overwrite resources.arsc (ON/OFF)

- overwrite classes.dex (ON/OFF)

- copy added resources (e.g. drawable-de-hdpi) (ON/OFF)

- overwrite any file in APK using _CUSTOM_RES (ON/OFF)

- copy optimized pngs to APK (ON/OFF) - EXPERIMENTAL @ the moment (20110503)

- -mx3 is the compression level for the meantime, i'll make it flexible after deotool and windows version

REQUIREMENTS:

- you must have java installed on your machine, you may even have it already, mine is this per the main log file

java version "1.6.0_21"

Java(TM) SE Runtime Environment (build 1.6.0_21-b07)

Java HotSpot(TM) 64-Bit Server VM (build 17.0-b17, mixed mode)

- tested on windows 7, x64 pc

- adb must be installed in the system, download the image attached to configure adb to be called globally in cmds

CREDITS

Brut.all for Apktool - a tool for reengineering apk files

http://www.7-zip.org - 7za commandline version

signapk.jar

optipng http://code.google.com/p/roptipng/

mogrify http://www.imagemagick.org/www/binary-releases.html#windows

guntherm6​6 for bringing mogrify close to this tool

********************************************************

AUTO APK TOOL CHANGELOG:

********************************************************

Version 5.0.0b

- Massive overhaul of codes

- New in this version is 87 and 88

87 = Can be use to remember single recompile of the last path (after 8)

Turn this ON and it will be active

88 = Is use to trigger the single recompile action

recompiling what is the last path

- Redo the recompile code

- Redo menu, starting from 21 is the new apktool 2.0.0.X settings

- 21 Use New apktool version

- 22 Use -f on recompile (this was migrated to work with new apktool and old apktool)

- 23 Use -c on recompile (this is new to work on new apktool)

- 24 Use -o on recompile (this is new to work on new apktool)

This will create a apkname_NEW.apk in _OUT_NEW folder

- 31 Overwrite resources.arsc

- 32 Overwrite classes.dex

- 33 Overwrite using _CUSTOM_RES

- 34 Copy added resources to APK

- 35 Make zipaligned apk from _OUT_APK

- 36 Force delete dir on Decompile (-f)

- 37 Optimized All PNGS in APKs

- 38 Optimized "xyz.9.png" PNGS in APKs

ISSUE:

- The ZIP Align is broken on some apks

- Use 42 ON but leave 43 and 44 off for now

- This will also be redo because the code right now zipaligns then sign

should be sign then zipalign

Version 4.0.2

- Added Menu 21 ON/OFF for new apktool support

- Changed Menu 22 ON/OFF settings saved, Overwrite resources.arsc

- Changed Menu 23 ON/OFF settings saved, Overwrite classes.dex

- Changed Menu 24 ON/OFF settings saved, Overwrite using _CUSTOM_RES

- Changed Menu 25 ON/OFF settings saved, Copy added resources to APK

- Changed Menu 26 ON/OFF settings saved, Make zipaligned apk from _OUT_APK

- Changed Menu 27 ON/OFF settings saved, Force delete dir on Decompile (-f)

- Changed Menu 28 ON/OFF settings saved, Force delete dir on Recompile (-f)

- Changed Menu 29 ON/OFF settings saved, Optimized All PNGS in APKs

- Changed Menu 30 ON/OFF settings saved, Optimized "xyz.9.png" PNGS in APKs

- Changed Menu 85 ON/OFF settings saved, Sign APKs after build themed apks

- Changed Menu 86 ON/OFF settings saved, Build a Flashable Theme Zip (after 84, 85)

version 4.0.1b

- Added support for new apktool 2.0.0b7

- Added menu 58, Open installed framework folder

- Improved colored menu to easily determine numbers from text

Colored_AutoAPKToolMain.bat	= colored code

AutoAPKToolMain.bat	= default code

- Obsoleted 13recompileICS.bat	= 13recompileICS.bat.obsolete

- Obsoleted 14rebuildusableICS.bat.obsolete	= 14rebuildusableICS.bat.obsolete

version 4.0.0

8:08 PM 12/20/2013

- Added autoinstall frameworks on application load

55, 56, 57

- chgcolor options for screen clarity (see acknowledgement in hep file)

- clean-up code for ICS decompile, unneeded file obsoleted but still on root directory

- clean-up menus and simplify terms on menus

- input text is set to yellow

- AutoAPKToolMain_Colored.bat is a colored text screen

- AutoAPKToolMain.bat is the original file (use this if _Colored fails on your system)

version 3.0.2

6:56 PM 8/19/2012

- Fixed displaying apktool version, remove 'if codes', now displays apktool name

as its version number, there's no need to change and add to this in the future

version 3.0.1

2:12 PM 8/4/2012

- Make the choosing of apktool version dynamic

- Your apktool must have "apktool" in the filename as prefix and obviously

extension is ".jar" (e.g. apktool_1.4.3.jar, apktool_1.3.1.jar)

- Fixed detecting apk before signing using option 43 and 44

version 3.0.0

10:09 PM 8/3/2012

- Option 42, 43, 44 explained

- Option 42, This is the raw APK tool output in dist (Without using my build apk)

_OUT_APKTOOL_DIST

- Option 43, This is the raw APK tool output then Zipaligned

_OUT_APKTOOL_DIST_ZIPALIGN

- Option 44, When 43 is ON, 44 is ON, the zipalinged apk gets signed

Option 44 wont work without 43 ON

There's a text file Sign_These_Then_Move.txt in _OUT_APKTOOL_DIST_ZIPALIGN

Apks listed here gets signed and moved to _OUT_APKTOOL_DIST_ZIPALIGN_SIGNED

modified by Agat63 03/31/12

version 2.0.4

1:31 AM 3/31/12

- Added decompile ICS apk

- Added recompile ICS apk

- Added baksmali JAR files

- Added baksmali DEX files

- Added smali JAR files

- Added smali DEX files

Version 2.0.3e

1:19 AM 7/5/2012

by xdaer Peteragent5

http://xdaforums.com/showpost.php?p=27566198&postcount=811

- I've added the option to use: apktool_1.4.3.jar

- And I've updated the aapt.exe from latest Android SDK

(Android SDK Platfrorm Tools - Rev.11)

Version 2.0.3b/c/d

3:27 PM 10/24/2011

(d)

- Added flexibility of building flashable zip, will build according to folder name

- Redo folder structure in building themed apks

(b)

- Added create themed folders

- Added apply Hue and Saturation on pngs

(a)

- Added build all themed, apks in all folders _THEMES

- Added build one themed, apks in specified folder _THEMES

- Option to sign apks after build

- Option to make a flashable zip

Version 2.0.3

- Changed folder handling in mogrify commands

- Added option to sign apk after mogrify themed apks are build and zipalign

- Fixed signing apks/zip commands

Version 2.0.2

- Added mogrify.exe and mogrify features

(Ability to change hues of PNGs, see acknowledgements for mogrify usage)

- Move Following APK DIST generated apk commands to recompile

(Copy generated apks of apktool in _OUT_APKTOOL_DIST)

(Create Zipalign apks in _OUT_APKTOOL_DIST to _OUT_APKTOOL_DIST_ZIPALIGN)

Version 2.0.1

- Added saving settings of copy apks and generate zip aligns in dist gen apks

- Added saving settings of compression level

Version 2.0.0

- Added adb reboot commands

- Added script to save apktool version after changing and use that on start of app

- Added option to only zipalign apks placed in the _OUT_APK folder

- Added move apks from _OUT_APK_ZIPALIGN to _OUT_APK

(useful before building flashable zip)

Version 1.0.9

- Added option to generate zipalign apks after each recompile

- goes to _OUT_APKTOOL_DIST_ZIPALIGN

- Separate option for apktool generated apks

Version 1.0.8

- Added option to toggle copying of apk from DIST folder of apktool gen directory

- Added zip align apks (generated apk from _OUT_APK to _OUT_APK_ZIPALIGN)

- Added setting of compression level

- Added Delete "folder name" of mod file text file

___If you have "Mod1" folder the file should be "Delete_Mod1.txt"

___Sample line in the text file is "AppShare\res\drawable-hdpi\installed.png"

___No need to specify the _INPUT_APK folder

___It will delete any file in that path once listed in the text file

- Fixed code jumping over optimization of pngs

Version 1.0.7

- Added install additional resources

Version 1.0.6

- Added more adb functions

- Added request for mods folders

- Fixed error handling when "Enter" key is pressed without choice

- Fixed menu choices for blank entry and "Enter" key is pressed as well

- Fixed mod folders applying only the last folder in menu

Version 1.0.5

- Added apktool 1.4.1, see brut's site for changelog

(Make sure you also have the aapt file from the latest migration notes)

http://code.google.com/p/android-apktool/downloads/list

- Added Single Recompile then Build

- Added adb commands and tools, you must have ADB installed and configure already,

(download "configure_adb_to_be_called_anywhere_in_cmd.rar")

- Reorganized menu for future improvements

Version 1.0.4

- Added optimized "xyz.9.png" in APKs option

Version 1.0.3

- Fix menu handling for option 19 to 21

- Changed "u" switch to "a" for handling copy added resources

- Added optimized PNGs in APKs option

Version 1.0.2

- Initial release