How to run (not only install) an android application using .apk file?

前端 未结 7 1331
孤独总比滥情好
孤独总比滥情好 2020-11-29 18:04

Is there any command on cmd.exe that would allow me to start the main activity of a particular android application using the .apk file of that appl

相关标签:
7条回答
  • 2020-11-29 19:02

    This is a solution in shell script:

    apk="$apk_path"
    

    1. Install apk

    adb install "$apk"
    sleep 1
    

    2. Get package name

    pkg_info=`aapt dump badging "$apk" | head -1 | awk -F " " '{print $2}'`
    eval $pkg_info > /dev/null
    

    3. Start app

    pkg_name=$name
    adb shell monkey -p "${pkg_name}" -c android.intent.category.LAUNCHER 1
    
    0 讨论(0)
提交回复
热议问题