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