Saturday, August 7, 2010

Android Reversing Environment Setup

All my instructions are going to be for GNU/Linux. I use ubuntu in particular, so a lot of my instructions will be customized for Ubuntu, although it should be possible from any GNU/Linux distribution, Mac OSX, and even windows also.

The ABSOLUTE very first step should be grabbing the android SDK. This can be done by going to the website: http://developer.android.com/sdk/index.html

and downloading your operating system's version, I'll assume we're running linux again.


  cd ~
  wget http://dl.google.com/android/android-sdk_r06-linux_86.tgz
  tar zvxf  android-sdk_r06-linux_86.tgz

Then we need to make a bin directory in our home since this is where we'll be placing all tools.

  mkdir ~/bin

Now you'll need to add this bin directory to your PATH.

In my ~/.bashrc I have at the very bottom

export PATH=/home/areversing/android-sdk-linux_86/tools:/home/areversing/bin:$PATH

I have the same in my ~/.bash_profile and ~/.bash_login but I'm not quite sure what all is neccessary.

Then you'll need to grab apktool and aapt like so:

  cd ~/bin
  wget http://android-apktool.googlecode.com/files/apktool-1.3.1.tar.bz2
  wget http://android-apktool.googlecode.com/files/apktool-install-linux-2.2_r01-1.tar.bz2
  tar jvxf apktool-1.3.1.tar.bz2
  tar jvxf apktool-install-linux-2.2_r01-1.tar.bz2
  rm *.bz2
 
You should now have apk installed!


Type the following at a newly created console window:
  adb --help
  apktool --help


If both of those do not give you detailed help, you did something wrong.

3 comments:

  1. You should really add that a Java JDK MUST be installed for jarsigner (and keytool if needed) !!!

    ReplyDelete
  2. A little FYI for anyone doing this on OS X - the instructions for the apktool on the site are wrong.

    After you unpack the .bz2 files, you must move the contents of the Mac specific download to /usr/local/bin (as the instructions say), but the main apktoolxxx.bz2 unpacks to a directory, not a jar file, as the apktool script expects.

    In order to get it to work you must:

    1. Copy the Manifest file from apktool/manifest to the top level directory, at the same level as the apktool directory
    2. Create a jar from this using the commandline:

    jar cvfm apktool.jar MANIFEST.MF -C apktool/ .

    3. Move the new apktool.jar to the /usr/local/bin directory alongside the apktool and aapt binaries.

    You should then ba able to execute the tool from the commandline.

    ReplyDelete