I want to create a shortcut to start a particular AVD with specific parameters. If I create a batch file with start emulator.exe -avd myavd
the emulator.exe command window shows and remains after the device is started. Closing the emulator.exe window closes the device.
How can I start a device without seeing this window like the AVD Manager or Eclipse does?
Create this java substituting the details for the avd you want:
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class AVDs
{
public static void main(String[] args) throws IOException
{
List<String> avdCmd = new ArrayList<String>(args.length + 1);
avdCmd.add("C:\\Users\\Steve\\AppData\\Local\\Android\\sdk\\tools\\emulator.exe");
for (String cmdarg: args)
{
avdCmd.add(cmdarg);
}
ProcessBuilder launch = new ProcessBuilder();
launch.inheritIO().command(avdCmd).start();
}
}
Then use this as your shortcut:
"C:\Program Files\Java\jre1.8.0_40\bin\javaw.exe" -cp "S:\ADT workspace\AVDs\bin" AVDs -timezone Europe/London -avd Lollipop -scale 0.5
Substituting your classpath, or removing it if you don't need it. Make sure you use a path to javaw, don't just use java.