skia2/platform_tools/android/bin/android_install_app
djsollen 425535f162 Update Android Apps to use gradle
This CL replaces ant with gradle for the task of building APKs.
The primary driver of this change is that it now allow us to
develop and test our apps using Android Studio.
DOCS_PREVIEW= https://skia.org/?cl=1215023017

Review URL: https://codereview.chromium.org/1215023017
2015-07-22 11:33:25 -07:00

62 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
#
# android_install_app: installs the skia sampleApp on the device.
function print_usage {
echo "USAGE: android_install_app [options]"
echo " Options: -f Forces the package to be installed by removing any"
echo " previously installed packages"
echo " -h Prints this help message"
echo " --release Install the release build of Skia"
echo " -s [device_s/n] Serial number of the device to be used"
echo " AppName Can be either sample_app or VisualBench"
}
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/android_setup.sh
source $SCRIPT_DIR/utils/setup_adb.sh
forceRemoval="false"
app=""
for arg in ${APP_ARGS[@]}; do
if [[ "${arg}" == "-f" ]]; then
forceRemoval="true"
elif [[ "${arg}" == "-h" ]]; then
print_usage
exit
elif [[ "${arg}" == "-r" ]]; then
echo "DEPRECATED: -r is now a no-op"
elif [[ ${arg} == '-'* ]]; then
echo "ERROR: unrecognized option ${arg}"
print_usage
exit 1;
else
if [[ ${app} != "" ]]; then
echo "ERROR: app already defined ${app}"
exit 1;
else
app=${arg}
fi
fi
done
if [[ ${app} == "" ]]; then
echo "defaulting to installing sample_app."
app="sample_app"
fi
if [[ "$forceRemoval" == "true" ]];
then
echo "Forcing removal of previously installed packages"
$ADB ${DEVICE_SERIAL} uninstall com.skia > /dev/null
fi
BUILD_TYPE_LC=$(echo $BUILDTYPE | tr "[:upper:]" "[:lower:]")
echo "Installing ${app} from ${app}/build/outputs/apk/${app}-${ANDROID_ARCH}-${BUILD_TYPE_LC}.apk"
$ADB ${DEVICE_SERIAL} install -r ${SCRIPT_DIR}/../apps/${app}/build/outputs/apk/${app}-${ANDROID_ARCH}-${BUILD_TYPE_LC}.apk