LoginSignup
25
20

More than 5 years have passed since last update.

adbコマンドを使ってマルチバイトテキストをスマホに送る方法

Posted at

Androidにアプリを入れたり、接続デバイス確認したり、何かとadbコマンドを利用していますが、「input text」で日本語が送れない問題にぶち当たりました・・・

adb
adb shell            # 端末にログインして
input text aiueo     # 送信OK
input text あいうえお
Killed               # 瞬殺

クリップボード経由で日本語を送信するなど色々試したもののうまくいかず・・・
やっと見つけました。

☆☆☆ ADBKeyBoard ☆☆☆

https://github.com/senzhk/ADBKeyBoard)

imeアプリになっていて、imeを「ADBKeyBoard」に切り替えてから利用します。

まず、上記のgithubからapkをダウンロードして、インストールしてください。
https://github.com/senzhk/ADBKeyBoard/blob/master/bin/ADBKeyBoard.apk)

adb
adb install -r ADBKeyBoard.apk

一気にテキストを送信してみます

adb
adb shell

# IMEをADBKeyBoardに切り替えます
ime set com.android.adbkeyboard/.AdbIME
# 日本語送信
am broadcast -a ADB_INPUT_TEXT --es msg 'あいうえお' 
# githubにも記載されてますが、keyeventのコードも実行できます
am broadcast -a ADB_INPUT_CODE --ei code 67

正直、エンジニアでも必要性がない人多数だと思いますが・・・
私としては大発見!!

25
20
2

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
25
20