I need to run the emulator from linux terminal. I've installed Android Studio on my Ubuntu VM, created device and successfully run it. Also i run it from terminal in android studio. but when i tried to run it from linux terminal i have this output:
root@mobyleapp2:~/Android/Sdk/emulator# sudo ./emulator -avd Pixel_6_API_34
INFO | Android emulator version 32.1.14.0 (build_id 10330179) (CL:N/A)
INFO | Found systemPath /root/Android/Sdk/system-images/android-34/google_apis/x86_64/
INFO | Storing crashdata in: /tmp/android-root/emu-crash.db, detection is enabled
INFO | Duplicate loglines will be removed, if you wish to see each indiviudal line launch with the -log-nofilter flag.
Authorization required, but no authorization protocol specified
Authorization required, but no authorization protocol specified
INFO | Warning: could not connect to display :0.0 ((null):0, (null))
INFO | Info: Could not load the Qt platform plugin "xcb" in "/root/Android/Sdk/emulator/lib64/qt/plugins" even though it was found. ((null):0, (null))
Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb.
((null):0, (null))
INFO | Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb.
((null):0, (null))
[76827:76827:20230824,104224.778525:ERROR elf_dynamic_array_reader.h:64] tag not found
[76827:76827:20230824,104224.778609:ERROR elf_dynamic_array_reader.h:64] tag not found
[76827:76827:20230824,104224.783132:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[76827:76827:20230824,104224.783153:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
Aborted
Both terminals use /bin/bash shell and the same env variables. For example my vars:
PATH=/root/Android/Sdk/emulator:/root/Android/Sdk/cmdline-tools:/root/Android/Sdk/build-tools:/root/Android/Sdk/platform-tools:/root/Android/Sdk/emulator:/root/Android/Sdk/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/root/Android/Sdk/platform-tools/
LD_LIBRARY_PATH = /usr/lib/x86_64-linux-gnu/qt5/plugins/
ANDROID_SDK_ROOT = /root/Android/Sdk/
ANDROID_HOME = /root/Android/Sdk/
JAVA_HOME=/opt/android-studio/jbr/
DISPLAY=:0.0
I used the same user root and same startup commands:
sudo ./emulator -avd Nexus_5X_API_34
My android studio path: /opt/android-studio/
i started studio with: sudo ./opt/android-studio/bin/studio.sh
from my default user "steam".
somehow i cannot run it from root user.
SDK path: /root/Android/Sdk
android studio version: Giraffe | 2022.3.1
I just need to start the emulator from other user cause graphics disabled for root user.