Skip to content

Instantly share code, notes, and snippets.

@josmas
Created September 14, 2014 04:00
Show Gist options
  • Save josmas/7b22fe5f64754678ab91 to your computer and use it in GitHub Desktop.
Save josmas/7b22fe5f64754678ab91 to your computer and use it in GitHub Desktop.
run-emulator script for App Inventor with quoted folder arguments
# Start the emulator for App Inventor
#!/bin/bash
# This is to try to get around a bug in the Android SDK where
# the emulator won't start and you'll see the message
# NAND: Could not create temp file for system NAND disk image.
# This is a permission problem on /tmp/android. Doing the
# rf here might not work either but it's worth a try. If this doesn't
# work, you should execute this remove command as root.
rm -rf /tmp/android
# cd to the directory where these commands are
cd `dirname $0`
# create the emulator directory if necessary
APPINVDIR="$HOME/.appinventor"
EMUDIR="$APPINVDIR/emulator"
if [ ! -d "$APPINVDIR" ]
then
mkdir "$APPINVDIR"
fi
if [ ! -d "$EMUDIR" ]
then
mkdir "$EMUDIR"
fi
# install the prebuilt user data image
EMDATA=Appinventor-emulator-data
DATAFILE="$EMUDIR/$EMDATA"
if [ ! -f "$DATAFILE" ]
then
cp ../extras/$EMDATA "$DATAFILE"
fi
# create the SD Card
SDCARDFILE="$EMUDIR/sdcard.img"
if [ ! -f "$SDCARDFILE" ]
then
./mksdcard 64M "$SDCARDFILE"
fi
./emulator -kernel ../from-Android-SDK/platforms/android-8/images/kernel-qemu \
-ramdisk ../from-Android-SDK/platforms/android-8/images/ramdisk.img \
-system ../from-Android-SDK/platforms/android-8/images/system.img \
-partition-size 84 \
-sdcard "$SDCARDFILE" \
-skindir ../from-Android-SDK/platforms/android-8/skins \
-skin HVGA-AppInventor \
-sysdir /$TMPDIR \
-data "$DATAFILE" \
-scale 0.7 \
-no-boot-anim \
&
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment