Youtubeでも解説していますので,是非ご覧ください. https://youtu.be/wC5thKOYw94
前回の記事で紹介した「Autoroid」システムを使うにあたり,
2つの環境が必要ですので,その設定を行っていきます.
adb環境の構築は以下の4Stepから行っていきます.
Youtubeでの解説動画は現在制作中ですので もうしばらくお待ちください.
こちらからSDK Platform-Toolsをダウンロードしてください.
ダウンロードして展開しadb.exeがある場所を確認します.
adb.exeがある場所にパスを通して行きます.
スマホのビルド名などを5回くらいタップすると開発者向けオプションが出現します. 出現しましたら,開発者向けオプションをオンにして,USBデバッグもオンにします.
PCに接続しているデバイスを確認できます.
adb devices
初めて行うときにはスマホ側に許可のメッセージが来ますので忘れずに許可してください.
C:\Users\Polaris2>adb devices
List of devices attached
f6a19bcb device
C:\Users\Polaris2>
コマンドのテンプレートです.シリアルの場所には上記で確認したデバイス名を入れてください.
adb -s {シリアル} shell screencap -p /sdcard/screenshot.png
adb -s {シリアル} pull /sdcard/screenshot.png ~/Desktop/
実際の送信コマンドです. これでSDカードにスクリーンショットを保存して,PCに転送してます.
adb -s f6a19bcb shell screencap -p /sdcard/screenshot.png
adb -s f6a19bcb pull /sdcard/screenshot.png image/capture
H:\マイドライブ\PROJECT\500_Lorem_captis_phalanx\500.02_Autoroid>adb -s f6a19bcb shell screencap -p /sdcard/screenshot.png
H:\マイドライブ\PROJECT\500_Lorem_captis_phalanx\500.02_Autoroid>adb -s f6a19bcb pull /sdcard/screenshot.png image/capture
/sdcard/screenshot.png: 1 file pulled, 0 skipped. 4.7 MB/s (86738 bytes in 0.018s)
ペイントなどでXY座標を確認してください
上記のペイントで「1」,「+」,「=」の位置を確認してコマンドを送信してみます.
adb -s f6a19bcb shell input touchscreen tap x y
adb -s f6a19bcb shell input touchscreen tap 145 1895
adb -s f6a19bcb shell input touchscreen tap 945 1885
adb -s f6a19bcb shell input touchscreen tap 145 1895
adb -s f6a19bcb shell input touchscreen tap 937 2100
これで,PCからスマホをタップすることができました.
今回はスマホに送信する座標はペイントで確認しましたが,次回からは画像処理を行って,自動で座標を算出するように組んでいきたいと思います.
関連リンク