title: String index out of bound when creating AVD from cmd
body: <p>I am trying to create an Android Virtual Device from command line. My code is following:</p>
  
  <pre><code>def create_emulator():
      emulator_name = "samsung_2"
      target_id = '5'
      abi = "android-tv/x86"
      android = config.config_file_reader('android')
      tools = config.config_file_reader('tools')
  
      emulator_create = str(subprocess.check_output([android,'create', 'avd', '-n', emulator_name, '-t', target_id, '-b', abi],stdin=subprocess.PIPE))
      emulator_create.stdin.write('no')
      return emulator_create
  </code></pre>
  
  <p>But it shows me the following error </p>
  
  <pre><code>Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
      at java.lang.String.checkBounds(String.java:381)
      at java.lang.String.&lt;init&gt;(String.java:545)
      at com.android.sdkmanager.Main.readLine(Main.java:1786)
      at com.android.sdkmanager.Main.promptForHardware(Main.java:1661)
      at com.android.sdkmanager.Main.createAvd(Main.java:1448)
      at com.android.sdkmanager.Main.doAction(Main.java:337)
      at com.android.sdkmanager.Main.run(Main.java:151)
      at com.android.sdkmanager.Main.main(Main.java:117)
  Traceback (most recent call last):
    File "/home/fahim/PycharmProjects/test_1/main_runner.py", line 27, in &lt;module&gt;
      main()
    File "/home/fahim/PycharmProjects/test_1/main_runner.py", line 9, in main
      instances = emulator.create_emulator()
    File "/home/fahim/PycharmProjects/test_1/emulator_manager.py", line 21, in create_emulator
      emulator_create = str(subprocess.check_output([android,'create', 'avd', '-n', emulator_name, '-t', target_id, '-b', abi],stdin=subprocess.PIPE))
    File "/usr/lib/python2.7/subprocess.py", line 574, in check_output
      raise CalledProcessError(retcode, cmd, output=output)
  subprocess.CalledProcessError: Command '['/home/fahim/Android/Sdk/tools/android', 'create', 'avd', '-n', 'samsung_2', '-t', '5', '-b', 'android-tv/x86']' returned non-zero exit status 1
  
  Process finished with exit code 
  </code></pre>
  
  <p>1
  what can i do? </p>