XDA user iBotPeaches now has a working Apktool 1.4.9. I recommend using this over the Apktool 1.4.4 I posted, as it is no longer necessary to modify XML files to recompile framework-res.apk and other APKs. I may post updated smali/baksmali binaries if anyone is interested, as I still build those frequently from the latest source.
Version 3.1 is now posted!
Note: 3.1 is a maintenance release containing working aapt binaries. You only need to re-download it if you haven't installed the latest Android SDK Platform-tools rev. 12.
I have been able to decompile / recompile SystemUI.apk, framework-res.apk (with patch), Browser.apk, Swype.apk, com.htc.resources.apk (with patch) without problems.
Changelog:
Code:
07/17/12 - Version 3.1
Added aapt binaries from Android SDK Platform-tools rev. 12 (Both Linux and Windows)
Added README file
Removed patches from the archive (download attached patches / fixed XML as needed)
07/15/12 - Version 3
Compiled apktool 1.4.4 with newest smali 1.3.4-dev (as of 07/15/12)
Attached apktool 1.4.4 and smali 1.3.4-dev build script for Linux (use this to build apktool and smali from source)
Attached all fixed XML files for framework-res.apk (mainly for Windows users, Linux users can use patch)
Attached patch for com.htc.resources.apk
Attached all fixed XML files for com.htc.resources.apk (mainly for Windows users, Linux users can use patch)
07/09/12
Fixed the framework-res_htc.patch file.
Patch file is now posted for those who have already downloaded v2.
Updated archive to include fixed framework-res_htc.patch file.
07/08/12 - Version 2
Modified the build process for apktool so it doesn't compile with outdated brut.apktool.smali and builds exclusively with Smali 1.3.4.
Recompiled apktool 1.4.4
Added aapt binary for Linux
Added apktool.bat file for Windows users
07/07/12 - Initial version
Compiled apktool 1.4.4, compiled Smali 1.3.4, merged into apktool.jar.
Description:
I have compiled the newest apktool 1.4.4 (merged with smali 1.3.4).
In the attached archive are apktool.jar, aapt, and apktool scripts for Linux and Windows.
Also attached are XML patches for some HTC framework files so they will compile with apktool.
I wanted to be able to decompile framework-res.apk (Sense 4.0), and other HTC APKs, with the latest apktool.
Previously, the only way to properly get HTC apks and Sense 4.0 framework-res.apk to decompile was having to use an older apktool 1.4.2 (modded by fernando sor). Now that shouldn't be necessary
Notes:
This was compiled and tested on Linux 64-bit, although the .jar file should work with Linux 32-bit and Windows.
The patch files won't work on Windows because they use unified context (only GNU Patch for Linux supports unified context).
Windows users can use the fixed XML files I attached, or make the necessary XML edits yourself.
For instructions on patching framework-res.apk XML files from Windows, refer to this post: http://forum.xda-developers.com/show....php?t=1601511
Download Instructions
Download attachment apktool-1.4.4_v3.1.tar.bz2
Download attachments containing patches or fixed XML
Extract all files to a folder ~/apktools/apktool is what I personally use.
Make sure you have aapt in your path (check your ~/.bashrc file to make sure).
aapt Note: The aapt binary (Linux and Windows) is included in the attachment. You can use this aapt, or you can get aapt by installing android-sdk.
Refer to this excellent tutorial for detailed instructions on setting up android-sdk: http://wiki.cyanogenmod.com/wiki/How...he_Android_SDK
./apktool if com.htc.resources.apk
./apktool if framework-res.apk
./apktool d framework-res.apk
Ignore any warnings about integers being out of range.
Patching XML files and Recompiling
Linux users only: Use the patch files I attached. Instructions are below. Windows or Linux users : Unzip patched XML file(s) into apktool folder and overwrite all files
Code:
patch -p0 -i framework-res_htc.patch
Now you should be able to recompile framework-res using apktool 1.4.4 without any errors:
Code:
./apktool b framework-res
Remember to extract the META-INF and AndroidManifest.xml from the ORIGINAL framework-res.apk to /framework-res/build/apk (signing apk) then build again:
Code:
./apktool b framework-res
Your signed framework-res.apk file will be in /framework-res/dist/.
Pushing Modified APK to Device
There are a few ways of doing this, but I will guide you through the process I use.
Connect your phone to your PC and issue the following command to boot into recovery:
Code:
adb reboot recovery
Once you are in recovery, make sure that /system is mounted.
Now issue these adb/shell commands to delete the existing APK and push the modified APK to your phone:
Now clear cache and dalvik cache in recovery and reboot system.
If your phone gets stuck in a boot loop or doesn't display the UI properly, then you didn't sign the APK properly.
Attachment back up! I recompiled apktool 1.4.4, compiled smali 1.3.4, and merged it into the apktool.jar file. I have been able to decompile / recompile SystemUI.apk and framework-res.apk without problems. I tried com.htc.resources.apk, and it decompiles without issue, but to recompile it needs XML edits that I don't have time to do at the moment.
I have compiled the newest apktool 1.4.4 (merged with smali 1.3.4) for Linux 64-bit (not tested on 32-bit).
I wanted to be able to decompile framework-res.apk (Sense 4.0), and other HTC APKs, with the latest apktool. Previously, the only way to properly get HTC apks and Sense 4.0 framework-res.apk to decompile was having to use an older apktool 1.4.2 (modded by fernando sor). Now that shouldn't be necessary
Attached is the apktool.jar file, an apktool bash script and a patch file for use in fixing framework-res.apk XML files to compile with apktool.
Download Directions:
Download apktool-1.4.4_smali-1.3.4.tar.bz2
Extract all files to a folder ~/apktools/apktool is what I personally use.
Make sure you have aapt in your path (check your .bashrc file to make sure).
chmod a+x apktool
chmod a+x apktool.jar
Installing Frameworks and Decompiling
cd ~/apktools/apktool
Copy over com.htc.resources.apk and framework-res.apk from /system/framework either by extracting a ROM .zip or using these adb commands:
apkchanger is much easier, no typing of commands or anything
and yes it decompiles sense 4 apks with ease
Yes, there are many scripts out there that automate using apktool. This is the latest version of apktool, which isn't included in most scripts yet. You could probably just use the apktool.jar file from this post and put it into apkchanger if you want. I'm also seeing that most modded apktools that decompile HTC APKs have a modified HeaderItem.java to get past errors when decompiling APKs. The version I posted has the entire Smali 1.3.4 build merged into apktool 1.4.4.
Ever since the introduction of multi-window with things like Cornerstone and … more
XDA Developers was founded by developers, for developers. It is now a valuable resource for people who want to make the most of their mobile devices, from customizing the look and feel to adding new functionality. Are you a developer?