| 1 |
|
| 2 |
How to install and run an android emulator. |
| 3 |
|
| 4 |
mkdir android # or any other place you prefer |
| 5 |
cd android |
| 6 |
|
| 7 |
# download java JDK |
| 8 |
# http://www.oracle.com/technetwork/java/javase/downloads/index.html |
| 9 |
# download android SDK |
| 10 |
# http://developer.android.com/sdk/index.html |
| 11 |
# download android NDK |
| 12 |
# http://developer.android.com/sdk/ndk/index.html |
| 13 |
|
| 14 |
# versions I used: |
| 15 |
# jdk-7u4-linux-i586.tar.gz |
| 16 |
# android-ndk-r8-linux-x86.tar.bz2 |
| 17 |
# android-sdk_r18-linux.tgz |
| 18 |
|
| 19 |
# install jdk |
| 20 |
tar xzf jdk-7u4-linux-i586.tar.gz |
| 21 |
|
| 22 |
# install sdk |
| 23 |
tar xzf android-sdk_r18-linux.tgz |
| 24 |
|
| 25 |
# install ndk |
| 26 |
tar xjf android-ndk-r8-linux-x86.tar.bz2 |
| 27 |
|
| 28 |
|
| 29 |
# setup PATH to use the installed software: |
| 30 |
export SDKROOT=$HOME/android/android-sdk-linux |
| 31 |
export PATH=$PATH:$SDKROOT/tools:$SDKROOT/platform-tools |
| 32 |
export NDKROOT=$HOME/android/android-ndk-r8 |
| 33 |
|
| 34 |
# install android platforms you want by starting: |
| 35 |
android |
| 36 |
# (from $SDKROOT/tools) |
| 37 |
|
| 38 |
# select the platforms you need |
| 39 |
# I selected and installed: |
| 40 |
# Android 4.0.3 (API 15) |
| 41 |
# Upgraded then to the newer version available: |
| 42 |
# Android sdk 20 |
| 43 |
# Android platform tools 12 |
| 44 |
|
| 45 |
# then define a virtual device: |
| 46 |
Tools -> Manage AVDs... |
| 47 |
# I define an AVD Name with 64 Mb SD Card, (4.0.3, api 15) |
| 48 |
# rest is default |
| 49 |
|
| 50 |
|
| 51 |
# compile and make install Valgrind, following README.android |
| 52 |
|
| 53 |
|
| 54 |
# Start your android emulator (it takes some time). |
| 55 |
# You can use adb shell to get a shell on the device |
| 56 |
# and see it is working. Note that I usually get |
| 57 |
# one or two time out from adb shell before it works |
| 58 |
adb shell |
| 59 |
|
| 60 |
# Once the emulator is ready, push your Valgrind to the emulator: |
| 61 |
adb push Inst / |
| 62 |
|
| 63 |
|
| 64 |
# IMPORTANT: when running Valgrind, you may need give it the flag |
| 65 |
# |
| 66 |
# --kernel-variant=android-no-hw-tls |
| 67 |
# |
| 68 |
# since otherwise it may crash at startup. |
| 69 |
# See README.android for details. |
| 70 |
|
| 71 |
|
| 72 |
# if you need to debug: |
| 73 |
# You have on the android side a gdbserver |
| 74 |
# on the device side: |
| 75 |
gdbserver :1234 your_exe |
| 76 |
|
| 77 |
# on the host side: |
| 78 |
adb forward tcp:1234 tcp:1234 |
| 79 |
$HOME/android/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gdb your_exe |
| 80 |
target remote :1234 |
| 81 |
|