How to pass command line options to the emulator in Android Studio?

前端 未结 3 1189
暗喜
暗喜 2021-01-07 16:29

I use Android Studio 2.1.3. When I run an Android app I pick an AVD, where can I pass command line options such as -http-proxy? I don\'t even find a way in the

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-07 16:49

    I found a hacky solution to add parameters to the Android Studio AVD.

    Android Studio by default uses the binary $ANDROID_SDK/emulator/emulator. In my case the path in MacOS is /Users/martin/Library/Android/sdk/emulator/emulator. What I did is:

    1. Rename the binary to emulator-original
    2. Create a bash script with the name emulator that contains:

      #!/bin/bash /Users//Library/Android/sdk/emulator/emulator-original $@

    3. Change the script permissions with chmod +x emulator

    Now Android Studio runs my script instead of running the binary

提交回复
热议问题