android

install emulator from command line

For generic skin emulator with default apis (without google apis):

  1. List All System Images Available for Download: sdkmanager --list | Select-String system-images

  2. Download Image: sdkmanager --install "system-images;android-29;default;x86"

  3. Create Emulator: echo "no" | avdmanager --verbose create avd --force --name "generic_10" --package "system-images;android-29;default;x86" --tag "default" --abi "x86"

    plaintext
    I recommend adding these lines to: ~/.android/avd/generic_10.avd/config.ini skin.name=1080x1920 # proper screen size for emulator hw.lcd.density=480 hw.keyboard=yes # enables keys from your laptop to be sent to the emulator If you cannot do this, you can still pass -skin 1080x1920 as an argument when starting the emulator.
  4. Run Emulator: emulator @generic_10 &

More info

showing stories in the browser

Stories not appearing in the browser once the emulator has loaded? Do the following then reload:

plaintext
adb reverse tcp:7007 tcp:7007

automate repetitive text entry

Use adb to automate repetitive text entry like login forms:

powershell
adb shell input text YOUR_EMAIL adb shell input keyevent 61 adb shell input text YOUR_PASSWORD adb shell input keyevent 66

install apk

powershell
adb install myapp.apk

logcat

powershell
adb logcat Capacitor:V AndroidRuntime:E *:E

permission denied in adb shell

For example:

bash
adb shell ls /data/user/0/<your-app-id>/files ls: /data/user/0/<your-app-id>/files: Permission denied

Instead do this:

bash
adb shell "run-as <your-app-id> ls /data/user/0/<your-app-id>/files"

starting the emulator from command line

Emulator installs to local AppData:

c:\Users\staff\AppData\Local\Android\Sdk\emulator

List avds

shell
emulator -list-avds Pixel_3_API_30

Warm boot

shell
emulator -avd Pixel_3_API_30

Cold boot

shell
emulator -avd Pixel_3_API_30 -no-snapshot-load

Clear data

shell
emulator -avd Pixel_3_API_30 -wipe-data

update emulator from commandline

plaintext
c:\Users\staff\AppData\Local\Android\Sdk\tools\bin λ sdkmanager --update

install certificate authority on android

  1. Download the certificate authority certificate: myCA.pem
  2. Settings > Security > Encryption and credentials > Install a certificate > CA certificate

posts