From 8cf70d4f69db6326407956a44a54c7fe5530a22c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20G=C3=A1lvez=20Vizca=C3=ADno?= Date: Mon, 27 May 2013 20:44:03 +0200 Subject: First version of the README and ant build.xml This is the first commit of this branch. It contains the README file with instructions for different user targets (Compiling, Running on the emulator and Debugging from console), and the ant build.xml file. debug.sh is an experimental script, because it uses "sleep" to synchronize between Emulator and adb install and run. If you want to use it, please look for that "sleep" lines and update their numbers according to your experience. --- debug.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 debug.sh (limited to 'debug.sh') diff --git a/debug.sh b/debug.sh new file mode 100755 index 0000000..c3f96ba --- /dev/null +++ b/debug.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +if [ -z "$2" ] +then + echo Usage: debug.sh \"avd name\" \"project folder\" + exit 0; +fi +avd_name=$1 +PROJECT_FOLDER=$2 +localport=`expr $RANDOM % 65536` + +emulator -wipe-data @$avd_name & # If you want to test the app from scratch +sleep 70 +adb install -r $PROJECT_FOLDER/bin/LEAP\ Android-debug.apk # Install the new version of the application +adb shell am start -D se.leap.leapclient/.Dashboard # Run app +pid=`adb shell ps | grep leap | awk '{print $2}'` # Identify the process id (pid) of the current leapclient process instance +adb forward tcp:$localport jdwp:$pid +sleep 3 +jdb -sourcepath $PROJECT_FOLDER/src/ -attach localhost:$localport -- cgit v1.2.3 From 14935459df410017f97428b0d98e0710b4141b63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Tue, 28 May 2013 17:18:49 +0200 Subject: debug.sh works without initial big sleep. I've found the way to detect if the emulator has finished booting, so that I can install and start leap_android without problems. I've moved the last sleep before the pid calculation, because sometimes it wasn't calculated well (I think because I asked for it too soon). --- debug.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'debug.sh') diff --git a/debug.sh b/debug.sh index c3f96ba..1867936 100755 --- a/debug.sh +++ b/debug.sh @@ -9,11 +9,25 @@ avd_name=$1 PROJECT_FOLDER=$2 localport=`expr $RANDOM % 65536` +wait_until_booted() { + OUT=`adb shell getprop init.svc.bootanim` + RES="stopped" + + while [[ ${OUT:0:7} != 'stopped' ]]; do + OUT=`adb shell getprop init.svc.bootanim` +# echo 'Waiting for emulator to fully boot...' + sleep 5 + done + + echo "Emulator booted!" +} + emulator -wipe-data @$avd_name & # If you want to test the app from scratch -sleep 70 +wait_until_booted adb install -r $PROJECT_FOLDER/bin/LEAP\ Android-debug.apk # Install the new version of the application adb shell am start -D se.leap.leapclient/.Dashboard # Run app +sleep 1 pid=`adb shell ps | grep leap | awk '{print $2}'` # Identify the process id (pid) of the current leapclient process instance +echo forwarding tcp:$localport to jwdp:$pid adb forward tcp:$localport jdwp:$pid -sleep 3 jdb -sourcepath $PROJECT_FOLDER/src/ -attach localhost:$localport -- cgit v1.2.3