| 1 | #This installs the Android SDK (Software Development Kit)
|
|---|
| 2 | #which is needed for the compilation of the Java project.
|
|---|
| 3 |
|
|---|
| 4 | step=3;
|
|---|
| 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`;
|
|---|
| 13 | default_droid="Android-4.0"
|
|---|
| 14 |
|
|---|
| 15 | if [[ $step == "1" ]]; then
|
|---|
| 16 |
|
|---|
| 17 | #Cleanup the install
|
|---|
| 18 | rm -rf install-sdk install-ant
|
|---|
| 19 |
|
|---|
| 20 | # Install Android SDK and NDK.
|
|---|
| 21 | unzip -o android-sdk-r16-macosx.zip
|
|---|
| 22 | unzip -o apache-ant-1.8.2-bin.zip
|
|---|
| 23 |
|
|---|
| 24 | #Move to install
|
|---|
| 25 | mv android-sdk-macosx install-sdk
|
|---|
| 26 | mv apache-ant-1.8.2 install-ant
|
|---|
| 27 |
|
|---|
| 28 | #Post_install configuration:
|
|---|
| 29 | #We need specific settings for specific platforms, for the SDK to
|
|---|
| 30 | #function properly
|
|---|
| 31 |
|
|---|
| 32 | #For now, we need to install:
|
|---|
| 33 | #android sdk platform tools
|
|---|
| 34 | #and a specific android api: API 15
|
|---|
| 35 | #Note: API 15 corresponds to Android 4.0.3
|
|---|
| 36 |
|
|---|
| 37 | cd install-sdk/tools/ && source ./android update sdk -t platform-tools,android-15,android-14,system-image --no-ui
|
|---|
| 38 |
|
|---|
| 39 | fi
|
|---|
| 40 |
|
|---|
| 41 | if [[ $step == "2" ]]; then
|
|---|
| 42 |
|
|---|
| 43 | #Once this is done, we need to install an emulator. Location will default to ~/.android/avd,
|
|---|
| 44 | #which we will move to $ISSM_TIER/externalpackages/android-emulators.
|
|---|
| 45 | #For now, it's called: Android-4.0.3
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 | #Here we delete the Android-4.0.3 device if it already exists.
|
|---|
| 49 | cd $present_dir/install-sdk/tools
|
|---|
| 50 |
|
|---|
| 51 | if [ -e $ANDROID_DIR/android-emulators/$default_droid ]
|
|---|
| 52 | then
|
|---|
| 53 | echo "Deleting previously created device: $default_droid"
|
|---|
| 54 | ./android delete avd -n $default_droid
|
|---|
| 55 | fi
|
|---|
| 56 |
|
|---|
| 57 | #Android will prompt the user to specify hardware emulation options. For now, default
|
|---|
| 58 | #default settings will suffice. Press 'enter' to take default settings or enter 'no'.
|
|---|
| 59 |
|
|---|
| 60 | ./android create avd -f -n $default_droid -t 1 -p $ANDROID_DIR/android-emulators/$default_droid --abi armeabi-v7a
|
|---|
| 61 | fi
|
|---|
| 62 |
|
|---|
| 63 | if [[ $step == "3" ]]; then
|
|---|
| 64 | #Here we will start up our default emulator to test that it is working properly.
|
|---|
| 65 | #Once the device has booted we will use the Android Debug Bridge tool to gain
|
|---|
| 66 | #a terminal in our device.
|
|---|
| 67 |
|
|---|
| 68 | cd $present_dir/install-sdk/tools
|
|---|
| 69 | ./emulator -avd $default_droid -sdcard $ANDROID_DIR/android-emulators/test &
|
|---|
| 70 |
|
|---|
| 71 | cd ../platform-tools
|
|---|
| 72 | ./adb wait-for-device shell
|
|---|
| 73 |
|
|---|
| 74 | fi
|
|---|
| 75 |
|
|---|
| 76 | if [[ $step == "4" ]]; then
|
|---|
| 77 | rm -rf install-sdk install-ant
|
|---|
| 78 | fi
|
|---|