Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've finally done it. I'm on a Mac environment so I used Applescript to simplify setting some variables, but this is achievable straight from the terminal.</p> <pre><code>set apkref to "install -r /path/to/your/app.apk" set appref to "shell am start -a android.intent.action.MAIN -n com.example.app/com.example.app.MainActivity" set sourceref to "/path/to/android/tools/" set devices to do shell script sourceref &amp; "adb devices | grep \"[device]$\" | sed 's/.device/\\ /' | sed 's/^/\\adb -s /' | sed 's@$@\\" &amp; apkref &amp; " \\&amp;" &amp; "@' | sed 's@^@\\" &amp; sourceref &amp; "@' | sed -E -e :a -e '$!N; s/\\n/ /g; ta'" do shell script devices set devices to do shell script sourceref &amp; "adb devices | grep \"[device]$\" | sed 's/.device/\\ /' | sed 's/^/\\adb -s /' | sed 's@$@\\" &amp; appref &amp; " \\&amp;" &amp; "@' | sed 's@^@\\" &amp; sourceref &amp; "@' | sed -E -e :a -e '$!N; s/\\n/ /g; ta'" do shell script devices </code></pre> <p>As you can see I'm just running some shell commands. Achieving this specific concatenation of sed's was a pain, but a great learning experience.</p> <p>The first shell script will install the apk in all the devices found through adb devices. If the app's already there, adb reinstalls it due to the -r flag. I concatenate the commands with &amp; so each command runs in the background, installing and running at the same time. Previously I tried concatenating the commands with &amp;&amp;, so each command waited for its turn and the result was a much slower process.</p> <p>The second shell script will run the app in all the devices. </p> <p>I'm sure this can be simplified by someone with greater knowledge of sed, but it works great for me.</p> <p>Inspired by this little experience, I went ahead and created Automator applications to do this and run adb logcat on each device (so when I ctrl+c out of one logcat, it starts the next one).</p> <p>I went so far as to create Services to run this Automator apps, however Eclipse in Mac OS X doesn't support Services. The workaround was to run the apps as External Tools.</p> <p>For extra flavour, I added Growl notifications in my Automator apps to tell me when adb is installing and running the app.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload