Get application version name using adb

后端 未结 5 2000
一整个雨季
一整个雨季 2021-01-30 02:20

Is there an easy way to get the version name of an application on an Android device using adb shell?

I found the application version number (not the version name) in /d

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-30 02:34

    If you want to get all package versions, try this awk script:

    adb shell dumpsys package | awk '/^[ ]*Package \[.*\] (.*)/ { i = index($0, "[") + 1; pkg = substr($0, i, index($0, "]") - i); } /[ ]*versionName=/ { { print pkg "\t" substr($0, index($0, "=") + 1); pkg = ""; } }'
    

提交回复
热议问题