Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ajgappmark
Forked from rriley/art-compile-arm.sh
Created July 9, 2017 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajgappmark/4b982b84c94dab218966bd17238e026f to your computer and use it in GitHub Desktop.
Save ajgappmark/4b982b84c94dab218966bd17238e026f to your computer and use it in GitHub Desktop.
A script to use the Android ART compiler to generate ARM binaries from apk files. Tested with Android 5.1.1_r4
# How to use ART to compile arm oat files on the host:
# - Get source code according to https://source.android.com/source/downloading.html
# - source build/envsetup.sh
# - mm build-art
# - Build the full android image for aosp_arm-eng
# (Follow the directions at https://source.android.com/source/building.html)
# - Use this script in the source root directory to compile APKs
CWD=`pwd`
export ANDROID_DATA="${CWD}/out/host/datadir/dalvik-cache/x86_64"
export ANDROID_ROOT="${CWD}/out/host/linux-x86"
BOOT_IMAGE="${CWD}/out/target/product/generic/system/framework/boot.art"
OUTPUT="${CWD}/out/oatfiles/arm"
mkdir -p $OUTPUT
mkdir -p $ANDROID_DATA
out/host/linux-x86/bin/dex2oat --runtime-arg -classpath --runtime-arg $1 --instruction-set=arm --runtime-arg -Xrelocate --host --boot-image=$BOOT_IMAGE --dex-file=$1 --oat-file=$OUTPUT/$1.oat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment