[11673] | 1 | #This installs the Android SDK (Software Development Kit)
|
---|
| 2 | #which is needed for the compilation of the Java project.
|
---|
[12579] | 3 | source $ANDROID_DIR/android_variables.sh
|
---|
[11673] | 4 |
|
---|
[12503] | 5 | step=1;
|
---|
[11673] | 6 |
|
---|
| 7 | #Different steps here.
|
---|
| 8 | #1: install sdk, ant and sdk tools
|
---|
| 9 | #2: install an emulator.
|
---|
| 10 | #3: test the emulator
|
---|
| 11 | #4: cleanup
|
---|
| 12 |
|
---|
| 13 | present_dir=`pwd`;
|
---|
[12227] | 14 | sd_card="issm-sdcard"
|
---|
[11673] | 15 |
|
---|
[12607] | 16 | ((tmp=$1 ))
|
---|
[12579] | 17 |
|
---|
[12607] | 18 | if [[ $tmp -ge "1" && $tmp -le "4" ]]; then
|
---|
[12579] | 19 | step=$1
|
---|
| 20 | else
|
---|
| 21 | echo "Using default step: " $step
|
---|
| 22 | fi
|
---|
| 23 |
|
---|
[11673] | 24 | if [[ $step == "1" ]]; then
|
---|
| 25 |
|
---|
| 26 | #Cleanup the install
|
---|
[12607] | 27 | rm -rf install-sdk
|
---|
[11673] | 28 |
|
---|
[12189] | 29 | #Download from ISSM server
|
---|
[12579] | 30 | $ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/android-sdk_r'$sdk_rev'-macosx.zip' 'android-sdk_r'${sdk_rev}'-macosx.zip'
|
---|
[12189] | 31 |
|
---|
[11673] | 32 | # Install Android SDK and NDK.
|
---|
[12579] | 33 | unzip -o android-sdk_r${sdk_rev}-macosx.zip
|
---|
[11673] | 34 |
|
---|
| 35 | #Move to install
|
---|
[12503] | 36 | mv -f android-sdk-macosx install-sdk
|
---|
[11673] | 37 |
|
---|
| 38 | #Post_install configuration:
|
---|
| 39 | #We need specific settings for specific platforms, for the SDK to
|
---|
| 40 | #function properly
|
---|
| 41 |
|
---|
| 42 | #For now, we need to install:
|
---|
| 43 | #android sdk platform tools
|
---|
[12579] | 44 | #and a specific android api: API 16, API 15 and API 14
|
---|
| 45 | #Note: API 16, API 15 and 14 correspond to Android 4.1, 4.0.3 and 4.0 respectively.
|
---|
[11673] | 46 |
|
---|
[12579] | 47 | cd install-sdk/tools/ && source ./android update sdk -t platform-tool,${api_levels},system-image --no-ui
|
---|
[11718] | 48 |
|
---|
[11673] | 49 | fi
|
---|
| 50 |
|
---|
| 51 | if [[ $step == "2" ]]; then
|
---|
| 52 |
|
---|
| 53 | #Once this is done, we need to install an emulator. Location will default to ~/.android/avd,
|
---|
[12156] | 54 | #which we will move to $ISSM_DIR/externalpackages/android-emulators.
|
---|
[11673] | 55 | #For now, it's called: Android-4.0.3
|
---|
| 56 |
|
---|
[11718] | 57 | #Here we delete the Android-4.0.3 device if it already exists.
|
---|
[11673] | 58 | cd $present_dir/install-sdk/tools
|
---|
| 59 |
|
---|
[12097] | 60 | if [ -e $ANDROID_DIR/android-emulators/$default_droid ]
|
---|
[11826] | 61 | then
|
---|
| 62 | echo "Deleting previously created device: $default_droid"
|
---|
| 63 | ./android delete avd -n $default_droid
|
---|
| 64 | fi
|
---|
| 65 |
|
---|
[11718] | 66 | #Android will prompt the user to specify hardware emulation options. For now, default
|
---|
| 67 | #default settings will suffice. Press 'enter' to take default settings or enter 'no'.
|
---|
| 68 |
|
---|
[12097] | 69 | ./android create avd -f -n $default_droid -t 1 -p $ANDROID_DIR/android-emulators/$default_droid --abi armeabi-v7a
|
---|
[12227] | 70 | echo "Creating an SD Card"
|
---|
| 71 | ./mksdcard -l $sd_card 2G $ANDROID_DIR/android-emulators/$sd_card.img
|
---|
[11673] | 72 | fi
|
---|
| 73 |
|
---|
| 74 | if [[ $step == "3" ]]; then
|
---|
[11968] | 75 | #Here we will start up our default emulator to test that it is working properly.
|
---|
[11925] | 76 | #Once the device has booted we will use the Android Debug Bridge tool to gain
|
---|
| 77 | #a terminal in our device.
|
---|
| 78 |
|
---|
[11718] | 79 | cd $present_dir/install-sdk/tools
|
---|
[12227] | 80 | ./emulator -avd $default_droid -sdcard $ANDROID_DIR/android-emulators/$sd_card.img &
|
---|
[11968] | 81 |
|
---|
[11925] | 82 | cd ../platform-tools
|
---|
[12607] | 83 | ./adb wait-for-device shell
|
---|
| 84 | #./adb wait-for-device shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock1 /system
|
---|
[12227] | 85 | #./adb wait-for-device shell
|
---|
[12607] | 86 | #./adb push $ISSM_TIER/src/c/issm.exe /data/issm.exe
|
---|
| 87 | #./adb shell chmod 777 /data/issm.exe
|
---|
| 88 | #./adb shell /data/issm.exe
|
---|
[11673] | 89 | fi
|
---|
| 90 |
|
---|
| 91 | if [[ $step == "4" ]]; then
|
---|
[12607] | 92 | rm -rf install-sdk
|
---|
[11673] | 93 | fi
|
---|