xBZZZZ / k2t

keyboard to touch for android studio's emulator on linux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

k2t — keyboard to touch for android studio's emulator on linux

what

  • you press key — fake virtual finger touches virtual touchscreen
  • you unpress key — fake virtual finger untouches virtual touchscreen

how

  1. make sure you have android studio
  2. make sure you have wish (package tk in opensuse tumbleweed and debian) installed
  3. download k2t_key_map_table_editor.tcl
  4. make k2t_key_map_table_editor.tcl executable (chmod +x '/path/to/k2t_key_map_table_editor.tcl')
  5. run k2t_key_map_table_editor.tcl
  6. click save as button
  7. click enable checkbox
  8. save maps.k2t (you can use other file name) to somewhere
  9. download libk2t_preload.so from latest releaseor
    1. create empty directory (I will name it /tmp/asd)
    2. download zig-linux-x86_64-*.tar.xz ("*" means any text here) using first link that looks like zig-linux-x86_64-*.tar.xz in https://ziglang.org/download/ into /tmp/asd (you can use other directory)
    3. open terminal
    4. cd '/tmp/asd'
    5. extract zig-linux-x86_64-*.tar.xz:
      tar -xJf zig-linux-x86_64-*.tar.xz
    6. download this repo:
      git clone --depth=1 https://github.com/xBZZZZ/k2t.git
    7. cd k2t
    8. compile libk2t_preload.so:
      ./build.sh ../zig-linux-x86_64-*/zig

    you now have libk2t_preload.so in /tmp/asd/k2t!
  10. open terminal
  11. cd '/path/to/android sdk directory/emulator/qemu/linux-x86_64'
  12. rename qemu-system-x86_64 to qemu-system-x86_64.real
    mv qemu-system-x86_64 qemu-system-x86_64.real
  13. create file qemu-system-x86_64:
    echo -n '#!/usr/bin/sh
    k2t_key_map_table="/path/to/maps.k2t" \
    LD_PRELOAD="/path/to/libk2t_preload.so${LD_PRELOAD:+" $LD_PRELOAD"}" \
    exec "$0.real" "$@"
    ' > qemu-system-x86_64
    (don't forget to replace /path/tos)
  14. make qemu-system-x86_64 executable:
    chmod +x qemu-system-x86_64
  15. start android virtual device as usual
  16. press A key, it should simulate touching top left (↖) corner

writing to maps.k2t file affects running emulator (exiting and opening emulator not needed)

extra links

About

keyboard to touch for android studio's emulator on linux

License:GNU General Public License v3.0


Languages

Language:Tcl 61.7%Language:Zig 37.6%Language:Shell 0.6%