Dare Project:
Source Code

Dare is built on top of the Android source code. The following instructions describe how to get the source for Android and Dare, and how to build all components of Dare.

Step 1: Get and compile the Android source code

Dare uses the android-4.0.3_r1 tag of the Android source code. Follow the instructions at http://source.android.com/source/initializing.html to set up your build environment for Android. We recommend using a Linux platform if you are planning on using the preverification functions of Dare. We currently cannot build the Dalvik verifier to run on Mac OS. Dare has been developed and tested on Ubuntu 11.04.

Next, you need to download version "android-4.0.3_r1" of the source code. Instructions to do so are available at http://source.android.com/source/downloading.html, but we summarize the main steps below (using the proper Android tag).

% mkdir ~/bin
% PATH=~/bin:$PATH
% curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
% chmod a+x ~/bin/repo
% mkdir ~/dare
% cd ~/dare
% repo init -u https://android.googlesource.com/platform/manifest \
-b android-4.0.3_r1
% repo sync

After the last command, you should wait until all the files are downloaded. When this is done, you should build Android, both to make sure that your build environment is properly set up and to generate some libraries used by Dare.

% source build/envsetup.sh
% lunch 2
% make

The last command will start building Android. You need to solve any build issues before moving on to the next step.

Step 2: Get and build the Dare source code

Download the Dare local_manifest.xml and place it in ~/dare/.repo:

% curl http://siis.cse.psu.edu/dare/downloads/local_manifest.xml > \
~/dare/.repo/local_manifest.xml
Next, get the source code.
% cd ~/dare
% repo sync
% cd dalvik
% mm

The last command will build the entire dalvik directory, including Dare and dexopt (which we use for preverification). Jasmin and Soot will also be built; the resulting archives will be in ~/dare/dalvik/dare/jasmin/lib and ~/dare/dalvik/dare/soot/lib, respectively.

Step 3: Build the boot-classpath

The boot-classpath classes are used for preverification by dexopt and for optimization and decompilation by Soot.

% cd ~/dare/dalvik/tools
% ./build-bcp ~/dare/out/target/common/obj/JAVA_LIBRARIES \
~/dare/dalvik/dare/libs/dex ~/dare/dalvik/dare/libs/class
% ./dex-preopt --bootstrap

You should then be able to launch Dare:

% ~/dare/out/host/<platform>/bin/dare [options] -d <output directory> \
<apk/dex file>

Valid options are:

  • -c : Optimize and decompile using Soot.
  • -o : Optimize using Soot.
  • -e : Do not split exception tables. By default, Dare splits exception tables to account for the differences in how try blocks are handled by the Dalvik and Java verifiers. This can make it more difficult for decompilers to process the resulting code. It is recommended to use this option if decompilation is your goal.
  • -p : Preverify the application using the Dalvik verifier and rewrite parts which are not verifiable.
  • -b : Generate class stubs for some missing class references.
  • -x <JVM option> : Set a Java VM option for the optimization and decompilation operations.