From 5b8217a3ad9c5b2e169c09c9612795bf5d9fee4f Mon Sep 17 00:00:00 2001 From: stulle123 Date: Wed, 19 Apr 2023 15:25:29 +0200 Subject: [PATCH] Add SSH instructions --- README.md | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 771c93f..bcda949 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,45 @@ sdkmanager "system-images;android-30;google_apis;arm64-v8a" brew install android-platform-tools # Create AVD Image avdmanager create avd -n kakao -k "system-images;android-30;google_apis;arm64-v8a" -# Start Emulator +# Start the emulator once and shut it down (this will create the 'config.ini' file) +emulator @kakao +# Configure AVD Image +sed -i -r 's/hw.keyboard = no/hw.keyboard = yes/' ~/.android/avd/kakao.avd/config.ini +sed -i -r 's/hw.mainKeys = yes/hw.mainKeys = no/' ~/.android/avd/kakao.avd/config.ini +# Start the emulator emulator @kakao ``` + +## SSH + +```bash +# Download Termux from https://github.com/termux/termux-app and install it, e.g.: +adb install termux-app_v0.118.0+github-debug_arm64-v8a.apk +# Install openssh in Termux +pkg upgrade +pkg install openssh +# Set a password for the SSH login in Termux +passwd +# Start SSH in Termux +sshd +# On your host set up redirection through the emulator console +cat ~/.emulator_console_auth_token +telnet localhost 5554 +auth +redir add tcp:4444:8022 +exit +# SSH into the emulator (no need to specify a user name) +ssh -p 4444 localhost +``` + +## Misc Commands + +```bash +# Start Termux +adb shell am start com.termux/.HomeActivity +# List 3rd-party Packages +adb shell pm list packages -f -3 +# Get Activities of an app +PACKAGE=com.termux +adb shell dumpsys package | grep -Eo $(printf "^[[:space:]]+[0-9a-f]+[[:space:]]+%s/[^[:space:]]+" "${PACKAGE}") | grep -oE "[^[:space:]]+$" +```