1 | #This installs the Android SDK (Software Development Kit)
|
---|
2 | #which is needed for the compilation of the Java project.
|
---|
3 | source $ANDROID_DIR/android_variables.sh
|
---|
4 |
|
---|
5 | step=1;
|
---|
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`;
|
---|
14 | sd_card="issm-sdcard"
|
---|
15 |
|
---|
16 | ((tmp=$1 ))
|
---|
17 |
|
---|
18 | if [[ $tmp -ge "1" && $tmp -le "4" ]]; then
|
---|
19 | step=$1
|
---|
20 | else
|
---|
21 | echo "Using default step: " $step
|
---|
22 | fi
|
---|
23 |
|
---|
24 | if [[ $step == "1" ]]; then
|
---|
25 |
|
---|
26 | #Cleanup the install
|
---|
27 | rm -rf install-sdk
|
---|
28 |
|
---|
29 | #Download from ISSM server
|
---|
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'
|
---|
31 |
|
---|
32 | # Install Android SDK and NDK.
|
---|
33 | unzip -o android-sdk_r${sdk_rev}-macosx.zip
|
---|
34 |
|
---|
35 | #Move to install
|
---|
36 | mv -f android-sdk-macosx install-sdk
|
---|
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
|
---|
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.
|
---|
46 |
|
---|
47 | cd install-sdk/tools/ && source ./android update sdk -t platform-tool,${api_levels},system-image --no-ui
|
---|
48 |
|
---|
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,
|
---|
54 | #which we will move to $ISSM_DIR/externalpackages/android-emulators.
|
---|
55 | #For now, it's called: Android-4.0.3
|
---|
56 |
|
---|
57 | #Here we delete the Android-4.0.3 device if it already exists.
|
---|
58 | cd $present_dir/install-sdk/tools
|
---|
59 |
|
---|
60 | if [ -e $ANDROID_DIR/android-emulators/$default_droid ]
|
---|
61 | then
|
---|
62 | echo "Deleting previously created device: $default_droid"
|
---|
63 | ./android delete avd -n $default_droid
|
---|
64 | fi
|
---|
65 |
|
---|
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 |
|
---|
69 | ./android create avd -f -n $default_droid -t 1 -p $ANDROID_DIR/android-emulators/$default_droid --abi armeabi-v7a
|
---|
70 | echo "Creating an SD Card"
|
---|
71 | ./mksdcard -l $sd_card 2G $ANDROID_DIR/android-emulators/$sd_card.img
|
---|
72 | fi
|
---|
73 |
|
---|
74 | if [[ $step == "3" ]]; then
|
---|
75 | #Here we will start up our default emulator to test that it is working properly.
|
---|
76 | #Once the device has booted we will use the Android Debug Bridge tool to gain
|
---|
77 | #a terminal in our device.
|
---|
78 |
|
---|
79 | cd $present_dir/install-sdk/tools
|
---|
80 | ./emulator -avd $default_droid -sdcard $ANDROID_DIR/android-emulators/$sd_card.img &
|
---|
81 |
|
---|
82 | cd ../platform-tools
|
---|
83 | ./adb wait-for-device shell
|
---|
84 | #./adb wait-for-device shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock1 /system
|
---|
85 | #./adb wait-for-device shell
|
---|
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
|
---|
89 | fi
|
---|
90 |
|
---|
91 | if [[ $step == "4" ]]; then
|
---|
92 | rm -rf install-sdk
|
---|
93 | fi
|
---|