Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emulator crashes on load() #15

Closed
AdamIshay opened this issue Jun 18, 2021 · 7 comments
Closed

Emulator crashes on load() #15

AdamIshay opened this issue Jun 18, 2021 · 7 comments

Comments

@AdamIshay
Copy link

After following the instructions for set up, I run the android emulator along with the following code:

env = android_env.load(
    avd_name='pixel2_30',
    android_avd_home='/path/.android/avd',
    android_sdk_root='/path/Android/Sdk',
    emulator_path='/path/Android/Sdk/emulator/emulator',
    adb_path='/path/Android/Sdk/platform-tools/adb',
    task_path='/path/android_env/tasks/accessibility_forwarder_clock_set_timer.textproto',
)

And the emulator crashes:

Traceback (most recent call last):
  File "/path/android_env/android_env/components/emulator_launcher.py", line 137, in launch
    self._emulator.expect('emulator: INFO: boot completed', timeout=wait_time)
  File "/path/anaconda3/lib/python3.6/site-packages/pexpect/spawnbase.py", line 344, in expect
    timeout, searchwindowsize, async_)
  File "/path/anaconda3/lib/python3.6/site-packages/pexpect/spawnbase.py", line 372, in expect_list
    return exp.expect_loop(timeout)
  File "/path/anaconda3/lib/python3.6/site-packages/pexpect/expect.py", line 179, in expect_loop
    return self.eof(e)
  File "/path/anaconda3/lib/python3.6/site-packages/pexpect/expect.py", line 122, in eof
    raise exc
pexpect.exceptions.EOF: End Of File (EOF).
<pexpect.popen_spawn.PopenSpawn object at 0x7f5a4e4416a0>
searcher: searcher_re:
    0: re.compile(b'emulator: INFO: boot completed')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 11, in <module>
    env = android_env.load(
  File "/path/android_env/android_env/loader.py", line 73, in load
    coordinator = coordinator_lib.Coordinator(simulator, task_manager)
  File "/path/android_env/android_env/components/coordinator.py", line 88, in __init__
    self._restart_simulator()
  File "/path/android_env/android_env/components/coordinator.py", line 181, in _restart_simulator
    self._simulator.launch()
  File "/path/android_env/android_env/components/base_simulator.py", line 135, in launch
    self._launch_impl()
  File "/path/android_env/android_env/components/emulator_simulator.py", line 114, in _launch_impl
    self.restart()
  File "/path/android_env/android_env/components/base_simulator.py", line 144, in restart
    self._restart_impl()
  File "/path/android_env/android_env/components/emulator_simulator.py", line 102, in _restart_impl
    self._launcher.restart()
  File "/path/android_env/android_env/components/emulator_launcher.py", line 151, in restart
    self.launch()
  File "/path/android_env/android_env/components/emulator_launcher.py", line 143, in launch
    raise errors.SimulatorCrashError('The emulator has crashed: %r' % e)
android_env.components.errors.SimulatorCrashError: The emulator has crashed: EOF("End Of File (EOF).\n<pexpect.popen_spawn.PopenSpawn object at 0x7f5a4e4416a0>\nsearcher: searcher_re:\n    0: re.compile(b'emulator: INFO: boot completed')",)

I'm not sure why this happens, any idea? Thanks!

@ouya99
Copy link

ouya99 commented Jun 21, 2021

@AdamIshay could you solve this issue on your system?

@kenjitoyama
Copy link
Collaborator

Hello @AdamIshay, could you check the locations of the Android Emulator, SDK and its associated tools (adb etc)? They're usually on your home directory, but it looks like you're passing /path/Android/Sdk/emulator/emulator which normally doesn't seem like a valid path. Please see https://github.com/deepmind/android_env/blob/main/docs/emulator_guide.md#ready-to-use and https://github.com/deepmind/android_env/blob/main/docs/instructions.md#create-the-environment.

@ouya99
Copy link

ouya99 commented Jun 21, 2021

@kenjitoyama thanks for your input. so "../Android/Sdk/emulator/emulator" is not the correct path? Got this same path from https://github.com/deepmind/android_env/blob/main/docs/instructions.md#create-the-environment

@kenjitoyama
Copy link
Collaborator

Hello @ouya99, normally the emulator is installed in the home directory, so using a relative path is probably not right as the working directory of the binary may change depending on the script location. It's better to use an absolute path.

@ouya99
Copy link

ouya99 commented Jun 21, 2021

python3 run_random_agent.py --avd_name='Pixel_XL_API_30' --android_avd_home='/home/username/.android/avd' --android_sdk_root=/home/username/Android/Sdk/ --emulator_path=/home/username/Android/Sdk/emulator/emulator --adb_path=/home/username/Android/Sdk/platform-tools/adb --num_steps=1000 --task_path=/home/username/Dev/android_env/examples/pong_default.textproto

@kenjitoyama this code solves the issue mentioned here. I think @AdamIshay had missed the error message stating that a directory (avd or sdk) had not been found. Yet now I am getting another error

E0622 00:49:36.111660 140665491404608 adb_controller.py:202] self._adb_shell.before: b"adb server version (39) doesn't match this client (41); killing...\r\n* daemon started successfully\r\nadb: device 'emulator-15414' not found\r\n" E0622 00:49:36.111877 140665491404608 adb_controller.py:203] Could not start ADB shell. Try 1 of 20.

@ouya99
Copy link

ouya99 commented Jun 21, 2021

@kenjitoyama ok, got it working after fixing adb version mismatch (hint: just remove the global adb installation, one is enough)

Thank you. You might close the issue

@kenjitoyama
Copy link
Collaborator

@ouya99 cool, thanks for confirming. I'll close the issue for now given that the OP was probably using the wrong path to the required files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants