From: Antonio Ospite Date: Fri, 9 Oct 2015 17:41:05 +0000 (+0200) Subject: compile_and_run_app.sh: adapt to the gradle project layout X-Git-Url: https://git.ao2.it/android/android-app-development-getting-started.git/commitdiff_plain/232a5bbf3e4055a1f34e20737fd9abef93686072?hp=e6820df27fcf1a240b88a0d8954102587026f4f5 compile_and_run_app.sh: adapt to the gradle project layout --- diff --git a/compile_and_run_app.sh b/compile_and_run_app.sh index 306d535..922ccba 100755 --- a/compile_and_run_app.sh +++ b/compile_and_run_app.sh @@ -14,10 +14,10 @@ else { echo "Install either xmllint or the XML::XPath perl module" 1>&2; exit 1; } fi -APP_NAME=$($XPATH "string(//project/@name)" build.xml) -PACKAGE=$($XPATH "string(//manifest/@package)" AndroidManifest.xml) -MAIN_ACTIVITY=$($XPATH "string(//activity[1]/@*[local-name() = 'name'])" AndroidManifest.xml) +APP_NAME=$($XPATH "string(//string[@name = 'app_name'])" src/main/res/values/strings.xml) +PACKAGE=$($XPATH "string(//manifest/@package)" src/main/AndroidManifest.xml) +MAIN_ACTIVITY=$($XPATH "string(//activity[1]/@*[local-name() = 'name'])" src/main/AndroidManifest.xml) -ant debug -adb -s emulator-5554 install -r bin/${APP_NAME}-debug.apk +./gradlew assembleDebug +adb -s emulator-5554 install -r build/outputs/apk/${APP_NAME}-debug.apk adb -s emulator-5554 -e shell am start -a android.intent.action.MAIN -n ${PACKAGE}/${PACKAGE}.${MAIN_ACTIVITY}