android_env icon indicating copy to clipboard operation
android_env copied to clipboard

Blocked after running loader.load

Open krishmatta opened this issue 1 year ago • 4 comments

I've come across an odd issue which wasn't occurring to me earlier. Whenever I run loader.load with proper configs, the emulator will start up. Once the emulator has started up, my entire Python process freezes and everything becomes blocked. The emulator doesn't start up the proper apk, it's just stuck on the home screen. Pressing Ctrl-C in the Python process exits the emulator, but does not exit the Python process. This is preventing me from even running run_random_agent.py I'm on an M2 Mac.

EDIT: I've tried reinstalling the package, reinstalling Android studio, and reinstalling everything in a fresh virtual environment. Nothing seems to work.

Full logs

krishmatta avatar May 15 '24 01:05 krishmatta

I have the same issues except that I can use the emulator on my laptop. I'm also on an M2 Mac, don't know if it's related.

hanyullai avatar May 15 '24 07:05 hanyullai

Hi, off the top of my head these lines are suspicious:

ERROR   | Error reading vhal json
INFO    | Wait for emulator (pid 10282) 20 seconds to shutdown gracefully before kill;you can set environment variable ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL(in seconds) to change the default value (20 seconds)

I don't know what vhal is, but maybe virtual hardware abstraction layer? If it is, it does seem related to hardware, but I don't have an ARM machine to test or reproduce this.

Do you also have AndroidEnv logs? The one in Pastebin seems to be only from the emulator.

Best,

Daniel

kenjitoyama avatar May 15 '24 11:05 kenjitoyama

Sorry for the late reply. Yes, I also have the same error log of ERROR | Error reading vhal json. Below is my emulator log.

idea.log

We also test it on another Mac and reproduce the bug.

hanyullai avatar May 17 '24 03:05 hanyullai

Hi,

This is the Android Emulator team. Do you have the python logs as well?

Also, could you try to close all Android Studio, and run the emulator from commandline? Sometimes Android Studio will fight with other processes in the background for the adb connections to the emulator. The emulator run command would be:

~/Library/Android/sdk/emulator/emulator -avd your_avd_name

yahanzhou avatar May 23 '24 22:05 yahanzhou

This issue will be closed due to inactivity.

kenjitoyama avatar Aug 05 '24 07:08 kenjitoyama

I am also getting this. Anything new reported on the subject?

Running a stock Google ARM64 image works but the minute I try to load my custom ROM (works for X86_64) it gets this error and nothing else.

PS: Where are the "python logs" mentioned above?

george-vlahakis avatar Sep 25 '24 00:09 george-vlahakis

Regarding ARM64 vs X86_64, they are very different. ARM64 almost only works on Mac M1/M2/M3 (there are a small amount of exceptions), X86_64 only works on regular linux/windows. You cannot mix them. You may try to run the emulator with your custom images on a x86_64 linux/windows machine.

BTW how did you build your custom ROM? If you are building it from AOSP with lunch aosp_x86_64-userdebug, you could try to change it to lunch aosp_arm64-userdebug, rebuild and it might work. (In general, change x86_64 to arm64.) If you heavily customized the .mk files then you might need to redo your customization for the arm config as well.

yahanzhou avatar Sep 25 '24 21:09 yahanzhou