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 run configuration.
4 Answers
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:
Rename the binary to
emulator-originalCreate a bash script with the name
emulatorthat contains:/Users/<YOUR_USERNAME>/Library/Android/sdk/emulator/emulator-original <PARAMS> $@```Change the script permissions with
chmod +x emulator
Now Android Studio runs my script instead of running the binary
Update: try Stef's solution first, it looks better than this hack
3 Comments
You can set emulator start parameters in an environment variable studio.emu.params; they will be added to the command line when AS starts the emulator, see source code.
Tested on Windows with AS 4.1 and set studio.emu.params=-writable-system.
4 Comments
set studio.emu.params=-gpu,angle_indirect is equivalent to command line emulator -gpu angle_indirect-dns-server 1.1.1.1 it fails to start with an error message of unknown option: -dns-server 1.1.1.1. This is with Windows 10.
emulator -avd name -http-proxy localhost:8888but I don't use the command line, I click on the run button in Android Studio so I want to set the options somewhere in the IDE.