Quick test procedure

  • glossy1
    Participant
    Post count: 3
    #81246 |

    I thought I would share this cmd/bash script I wrote that will copy your newly-made APK file to your USB-connected phone and launch it immediately. I find that looking at it on my real phone helps me better than seeing it in an emulator.

    Windows

    @echo off
    if %1!==! (
     echo Syntax: %0 ^<filename.apk^>
     exit/b
    )
    
    for %%a in (adb.exe aapt.exe) do (
     if not exist %%~$PATH:a (
      echo %%a not found in path. Please resolve and try again. Exiting...
      exit /b
     )
    )
    
    for /f "tokens=2 delims='" %%a in ('aapt dump badging %1 ^| findstr "^package"') do (
     echo adb shell monkey -p %%a -c android.intent.category.LAUNCHER 1
    )

    Mac/Linux

    #!/bin/bash
    
    if [ -z $1 ]; then
     echo Syntax: "$0 <filename.apk>"
     exit
    fi
    
    type -P adb aapt >/dev/null
    if [ $? != 0 ]; then
      echo Both adb and aapt must in the path. Please resolve and try again. Exiting...
      exit
    fi
    
    adb shell monkey -p <code>aapt dump badging $1 | grep &quot;^package&quot; | cut -d \' -f 2</code> -c android.intent.category.LAUNCHER 1

    Note, I haven’t tested this one in Mac or Linux but it should work. 🙂

  • blueblade
    Participant
    Post count: 6
    #81296 |

    Cool script. There is also a built in option for this in SAB. Tools > Settings > After Build – then select the following options:
    Install app on attached phone or tablet after apk is built
    Run app as soon as it has been installed

    The section also describes how to put the phone in USB debugging mode for this to work.

    Screenshot of SAB settings

  • glossy1
    Participant
    Post count: 3
    #87779 |

    How about that… thanks for pointing this out!

You must be logged in to reply to this topic.