Why not login to Qiita and try out its useful features?

We'll deliver articles that match you.

You can read useful information later.

12
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

dumpsys activity activitiesとpecoでゴニョゴニョして端末からapkを簡単に引っこ抜く

Last updated at Posted at 2016-12-21

昔々に「端末からapkを引っこ抜きたいけど、それどこにあるん?」というネタを書いたんだけど、それの応用編。

端末からapkを引っこ抜きたいけど、それどこにあるん?

※zshでは動いてますが、他は知らん

apkの場所がわかったら、さくっと端末から引っこ抜きたいやん

それできますよ:muscle:

以下のような感じでいくつかのコマンドをパイプつなぎで渡して、pecoとか使ってあげればいい感じに引っこ抜ける!

adb shell dumpsys activity activities | grep apk | sed -e 's/ *baseDir=//g' | peco | xargs adb pull

Demo

こんな感じ:relaxed:いい感じ:relaxed:

apk_pull.gif

pecoなのでfilterも選択も簡単だねーさいこー:thumbsup_tone1::thumbsup_tone2::thumbsup_tone3::thumbsup_tone4::thumbsup_tone5:

aliasとかにしておくと楽

自分はこんな感じでaliasしてま:sushi:

alias apkpull="adb shell dumpsys activity activities | grep apk | sed -e 's/ *baseDir=//g' | peco | xargs adb pull"

引っこ抜きたいアプリを起動した上で、コマンドを実行するといいよ!

dumpsys activityの出力からゴニョゴニョしているということは、フォアグラウンド or バックグラウンドにActivityが存在するアプリのapkしか出てこないという点があるよ!

端末にインストールされてるすべてのアプリのapk出されても困るからね!

引っこ抜きたいアプリを起動した上で、紹介したコマンドを実行するといいよ:dagger:

12
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Qiita Conference 2025 will be held!: 4/23(wed) - 4/25(Fri)

Qiita Conference is the largest tech conference in Qiita!

Keynote Speaker

ymrl、Masanobu Naruse, Takeshi Kano, Junichi Ito, uhyo, Hiroshi Tokumaru, MinoDriven, Minorun, Hiroyuki Sakuraba, tenntenn, drken, konifar

View event details
12
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?