5

I would like to decompile and recompile an .apk in Android (I want to gain access to the Android Manifest of some apps). I know the APKTool, but I want to know if it's possible to decompile an apk in Android (decompiler as an Android App).

Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
Ahmad
  • 69,608
  • 17
  • 111
  • 137
  • It would be a security risk if you could decompile and recreate the .apk, so you may be able to decompile it, but not the second part, and neither on the Android. – James Black May 27 '12 at 02:27
  • 1
    Not exactly true. [AntiLvl](http://androidcracking.blogspot.com/p/antilvl.html), [APKTool](http://code.google.com/p/android-apktool/) and [APKInspector](http://code.google.com/p/apkinspector/) have made it almost trivial to decompile/recompile apps. Security risk? Yes but as a developer there are some ways to make it at least a bit more difficult (obfuscation is just one example that comes to mine) – KDEx May 27 '12 at 02:45
  • the correct link for AntiLvl is: http://androidcracking.blogspot.com/p/antilvl_01.html – codechurn Feb 09 '13 at 23:17

2 Answers2

9

Getting at the manifest is easy. Change the extension from .apk to .zip and extract the manifest. The majority of the time, it's left intact and parsable. In the case that it's not, there are plenty of free, open-source tools that you can use. APKTool is a great one to use as well. Taking a look at the source code can give you a better idea on how to achieve this, and then you can implement it in the Android environment.

dda
  • 6,030
  • 2
  • 25
  • 34
KDEx
  • 3,505
  • 4
  • 31
  • 39
  • I might also add, that there is a modern alternative to this APKTool->dex2jar-> any decompiler route! Just try open-source APK and DEX decompiler called Jadx: https://sourceforge.net/projects/jadx/files/ It has also online version here: http://www.javadecompilers.com/apk – Andrew Rukin Sep 02 '15 at 15:13
2

Shameless plug, I just created an open-source package that manages the APK decompilation process at https://github.com/lxdvs/apk2gold.

apktool decompiles to Smali; my package, apk2gold, will decompile to Java.

Alex Davis
  • 119
  • 1
  • 3
  • 1
    He would like to recompile his apks. Have fun trying to re-compile dex2jar apks. apktool on the other hand, will recompile the apks and work fine on the device :) – Connor Tumbleson Feb 04 '13 at 04:33
  • @Alex Davis Could you please list the set of steps required to run make.sh in windows. I tried using git bash, a bunch of errors got thrown indicating that make.sh was not associated with any git project. I downloaded win-bash and now the error is associated with maven bin not existing and JAVA_HOME not being specified. The bottom line is: *.sh files are meant for linux or mac based operating systems. Usually with windows, there is an equivalent *.bat (batch executable). What approach do you recommend for windows in this case? – iOSAndroidWindowsMobileAppsDev Aug 11 '16 at 11:56