question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AndroidEnv does not work in WSL

See original GitHub issue

I’ve setup android studio on windows and am trying to load the environment from WSL. I have got an unexpected keyword argument 'use_poll' error while trying to load the environment. Any ideas on how I can fix this?

Full error:

>>> import android_env
>>> env = android_env.load(avd_name='Pixel_2_API_30', android_avd_home='/mnt/c/Users/Surya Penmetsa/.android/avd/Pixel_2_API_30.avd', android_sdk_root='/mnt/c/Users/Surya Penmetsa/AppData/Local/Android/Sdk', emulator_path='/mnt/c/Users/Surya Penmetsa/AppData/Local/Android/Sdk/emulator/emulator.exe', adb_path='/mnt/c/Users/Surya Penmetsa/AppData/Local/Android/Sdk/platform-tools/adb.exe', task_path='downloads/classic_2048.textproto')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/surya/anaconda3/lib/python3.6/site-packages/android_env/loader.py", line 73, in load
    coordinator = coordinator_lib.Coordinator(simulator, task_manager)
  File "/home/surya/anaconda3/lib/python3.6/site-packages/android_env/components/coordinator.py", line 88, in __init__
    self._restart_simulator()
  File "/home/surya/anaconda3/lib/python3.6/site-packages/android_env/components/coordinator.py", line 181, in _restart_simulator
    self._simulator.launch()
  File "/home/surya/anaconda3/lib/python3.6/site-packages/android_env/components/base_simulator.py", line 136, in launch
    self._post_launch_setup()
  File "/home/surya/anaconda3/lib/python3.6/site-packages/android_env/components/emulator_simulator.py", line 117, in _post_launch_setup
    super()._post_launch_setup()
  File "/home/surya/anaconda3/lib/python3.6/site-packages/android_env/components/base_simulator.py", line 151, in _post_launch_setup
    self._adb_controller.get_screen_dimensions())
  File "/home/surya/anaconda3/lib/python3.6/site-packages/android_env/components/adb_controller.py", line 459, in get_screen_dimensions
    self._wait_for_device(timeout=timeout)
  File "/home/surya/anaconda3/lib/python3.6/site-packages/android_env/components/adb_controller.py", line 234, in _wait_for_device
    ready = self._check_device_is_ready(timeout=timeout)
  File "/home/surya/anaconda3/lib/python3.6/site-packages/android_env/components/adb_controller.py", line 247, in _check_device_is_ready
    ['shell', 'service', 'check', service], timeout=timeout)
  File "/home/surya/anaconda3/lib/python3.6/site-packages/android_env/components/adb_controller.py", line 116, in _execute_command
    adb_output = self._execute_shell_command(args[1:], timeout=timeout)
  File "/home/surya/anaconda3/lib/python3.6/site-packages/android_env/components/adb_controller.py", line 149, in _execute_shell_command
    self._init_shell(timeout=timeout)
  File "/home/surya/anaconda3/lib/python3.6/site-packages/android_env/components/adb_controller.py", line 191, in _init_shell
    self._adb_shell = pexpect.spawn(command, use_poll=True, timeout=timeout)
TypeError: __init__() got an unexpected keyword argument 'use_poll'

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
kenjitoyamacommented, Jun 14, 2021

Hello @psurya1994, it’s ok to leave it open. We are also planning to use a different communication mechanism (gRPC) which could help here and remove the need for this particular pexpect call. Eventually we do want to support running on Windows via WSL. Tagging @a-gergely who’s been experimenting with gRPC.

Thanks,

Daniel

1reaction
kenjitoyamacommented, Jun 11, 2021

Hello @psurya1994, we have never tried running AndroidEnv on Windows, so thanks for the report.

From the error message, it looks like it’s a limitation in one of the libraries we use, pexpect, which does not offer popen.spawn on Windows. According to their docs, we can try to see if we can use PopenSpawn but it would be better if you can try it in your local machine and report back to us since we don’t have Windows machines to try.

Let me know what you think,

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android emulator not starting anymore · Issue #6471 - GitHub
I used to run WSL2, Docker (WSL2) and Android Studio emulator side-by-side. Everything worked. Docker was up and running in WSL2. I could...
Read more >
How to connect Android Studio running inside WSL2 with ...
Just look around for how to run GUI apps on WSL2. You will need to install a desktop shell, enable remote desktop services...
Read more >
Can WSL2 use the Android SDK installed on Windows?
WSL can run Windows programs but they will be run as normal Windows processes. I'm not familiar with the program that you are...
Read more >
How to Set Up React-Native on Your WSL2 for Android ...
Inside WSL terminal, enter your .bashrc file. cd ~ vim .bashrc # use any editor to open the file. It should match with...
Read more >
Developing in WSL - Visual Studio Code
Note: If you are an extension author and your extension is not working properly or installs in the wrong place, see Supporting Remote...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found