compile_and_run_app.sh: adapt to the gradle project layout
authorAntonio Ospite <ao2@ao2.it>
Fri, 9 Oct 2015 17:41:05 +0000 (19:41 +0200)
committerAntonio Ospite <ao2@ao2.it>
Fri, 9 Oct 2015 17:41:05 +0000 (19:41 +0200)
compile_and_run_app.sh

index 306d535..922ccba 100755 (executable)
@@ -14,10 +14,10 @@ else
   { echo "Install either xmllint or the XML::XPath perl module" 1>&2; exit 1; }
 fi
 
   { 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}
 adb -s emulator-5554 -e shell am start -a android.intent.action.MAIN -n ${PACKAGE}/${PACKAGE}.${MAIN_ACTIVITY}