Describe the bug
Android emulator launched from Android Studio FHS environment crashes with error message
Emulator: /home/alapshin/opt/android-sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
Looks like nss is missing from FHS environment used for launching Android Studio. To launch emulator I had to add a bunch of missing libraries into https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/android-studio/common.nix
diff --git b/pkgs/android-studio/common.nix a/pkgs/android-studio/common.nix
index 0d406ad..9d3ec80 100644
--- b/pkgs/android-studio/common.nix
+++ a/pkgs/android-studio/common.nix
@@ -1,8 +1,11 @@
{ channel, pname, version, build, sha256Hash }:
-{ bash
+{ alsaLib
+, bash
, buildFHSUserEnv
, coreutils
+, dbus
+, expat
, fetchurl
, findutils
, file
@@ -19,12 +22,19 @@
, libpulseaudio
, libGL
, libX11
+, libxcb
+, libXcomposite
+, libXcursor
+, libXdamage
, libXext
+, libXfixes
, libXi
, libXrandr
, libXrender
, libXtst
, makeWrapper
+, nspr
+, nss
, pciutils
, pkgsi686Linux
, setxkbmap
@@ -99,9 +109,19 @@ let
libXrandr
# For Android emulator
+ alsaLib
+ dbus
+ expat
libpulseaudio
- libX11
libGL
+ libX11
+ libxcb
+ libXcomposite
+ libXcursor
+ libXdamage
+ libXfixes
+ nspr
+ nss
# For GTKLookAndFeel
gtk2
Even with additional libraries emulator prints following warnings during launch
Emulator: Warning: QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled ((null):0, (null))
Emulator: emulator: ERROR: VkCommonOperations.cpp:496: Failed to create Vulkan instance.
but main emulator functionality works. However if I try to open emulator settings from emulator interface itself (floating toolbar) emulator crashes with stacktrace:
9:37 AM Emulator: Qt WebEngine ICU data not found at /usr/local/google/home/joshuaduong/qt-build-5.12.1/install-linux-x86_64/resources. Trying parent directory...
9:37 AM Emulator: Qt WebEngine ICU data not found at /usr/local/google/home/joshuaduong/qt-build-5.12.1/install-linux-x86_64. Trying application directory...
9:37 AM Emulator: Installed Qt WebEngine locales directory not found at location /usr/local/google/home/joshuaduong/qt-build-5.12.1/install-linux-x86_64/translations/qtwebengine_locales. Trying application directory...
9:37 AM Emulator: Qt WebEngine locales directory not found at location /home/alapshin/opt/android-sdk/emulator/lib64/qt/libexec/qtwebengine_locales. Trying fallback directory... Translations MAY NOT not be correct.
9:37 AM Emulator: Path override failed for key ui::DIR_LOCALES and path '/home/alapshin/.QtWebEngineProcess'
9:37 AM Emulator: Qt WebEngine resources not found at /usr/local/google/home/joshuaduong/qt-build-5.12.1/install-linux-x86_64/resources. Trying parent directory...
9:37 AM Emulator: Qt WebEngine resources not found at /usr/local/google/home/joshuaduong/qt-build-5.12.1/install-linux-x86_64. Trying application directory...
9:37 AM Emulator: [1009/123732.068789:WARNING:resource_bundle_qt.cpp(116)] locale_file_path.empty() for locale
9:37 AM Emulator: [23791:24242:1009/123732.101093:FATAL:udev_loader.cc(38)] Check failed: false.
9:37 AM Emulator: #0 0x7f3721dd6bab <unknown>
9:37 AM Emulator: #1 0x7f3721d4d1cf <unknown>
9:37 AM Emulator: #2 0x7f372091c696 <unknown>
9:37 AM Emulator: #3 0x7f372091b758 <unknown>
9:37 AM Emulator: #4 0x7f372091c1de <unknown>
9:37 AM Emulator: #5 0x7f3720a2b7b2 <unknown>
9:37 AM Emulator: #6 0x7f3721d37f80 <unknown>
9:37 AM Emulator: #7 0x7f3721d56601 <unknown>
9:37 AM Emulator: #8 0x7f3721d56be6 <unknown>
9:37 AM Emulator: #9 0x7f3721de6e78 <unknown>
9:37 AM Emulator: #10 0x7f3721d72944 <unknown>
9:37 AM Emulator: #11 0x7f37217fab63 <unknown>
9:37 AM Emulator: #12 0x7f3721db026e <unknown>
9:37 AM Emulator: #13 0x7f3721de1cb6 <unknown>
9:37 AM Emulator: #14 0x7f37276ccef6 start_thread
9:37 AM Emulator: #15 0x7f372546022e __GI___clone
9:37 AM Emulator:
9:37 AM Emulator: Received signal 6
9:37 AM Emulator: #0 0x7f3721dd6bab <unknown>
9:37 AM Emulator: #1 0x7f3721dd6700 <unknown>
9:37 AM Emulator: #2 0x7f37276d785f <unknown>
9:37 AM Emulator: #3 0x7f37253a2be0 __GI_raise
9:37 AM Emulator: #4 0x7f37253a3dc0 __GI_abort
9:37 AM Emulator: #5 0x7f3721dd5534 <unknown>
9:37 AM Emulator: #6 0x7f3721d4d63b <unknown>
9:37 AM Emulator: #7 0x7f372091c696 <unknown>
9:37 AM Emulator: #8 0x7f372091b758 <unknown>
9:37 AM Emulator: #9 0x7f372091c1de <unknown>
9:37 AM Emulator: #10 0x7f3720a2b7b2 <unknown>
9:37 AM Emulator: #11 0x7f3721d37f80 <unknown>
9:37 AM Emulator: #12 0x7f3721d56601 <unknown>
9:37 AM Emulator: #13 0x7f3721d56be6 <unknown>
9:37 AM Emulator: #14 0x7f3721de6e78 <unknown>
9:37 AM Emulator: #15 0x7f3721d72944
9:37 AM Emulator: <unknown>
9:37 AM Emulator: #16 0x7f37217fab63 <unknown>
9:37 AM Emulator: #17 0x7f3721db026e <unknown>
9:37 AM Emulator: #18 0x7f3721de1cb6 <unknown>
9:37 AM Emulator: #19 0x7f37276ccef6 start_thread
9:37 AM Emulator: #20 0x7f372546022e __GI___clone
9:37 AM Emulator: r8: 0000000000000000 r9: 00007f367395eac0 r10: 0000000000000008 r11: 0000000000000246
9:37 AM Emulator: r12: 00007f367395f1b0 r13: 000000000000004f r14: 00007f367395f1b8 r15: 00007f367395f1c0
9:37 AM Emulator: di: 0000000000000002 si: 00007f367395eac0 bp: 00007f367395ed00 bx: 00007f367395ed70
9:37 AM Emulator: dx: 0000000000000000 ax: 0000000000000000 cx: 00007f37253a2be0 sp: 00007f367395eb38
9:37 AM Emulator: ip: 00007f37253a2be0 efl: 0000000000000246 cgf: 002b000000000033 erf: 0000000000000004
9:37 AM Emulator: trp: 000000000000000e msk: fffffffe7ffbfedf cr2: 00007f93279e6100
9:37 AM Emulator: [end of stack trace]
9:37 AM Emulator: Calling _exit(1). Core file will not be generated.
9:37 AM Emulator: Process finished with exit code 1
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Emulator should launch and work
Additional context
I seem to remember that emulator was working fine in nixos-unstable a couple of month ago until 20.03 was merged in but can't say for sure since I didn't use it until recently.
Metadata
"x86_64-linux"
Linux 5.3.5, NixOS, 20.03pre196201.07d4df59626 (Markhor)
yes
yes
nix-env (Nix) 2.3
"nixos-20.03pre196201.07d4df59626"
""
/nix/var/nix/profiles/per-user/root/channels/nixos
Maintainer information:
# a list of nixpkgs attributes affected by the problem
attribute: android-studio
# a list of nixos modules affected by the problem
module:
@alapshin thank you very much for the detailed bug report, that's very useful :)
@alexbakker created a PR that should address this issue: #70857
But unfortunately I didn't have time to test it yet (I don't use Android-Studio anymore and did only test the builds on my Desktop-PC where the Emulator doesn't run (IIRC due to the AMD CPU, possibly also due to the incompatible GPU)).
Comparing your patch with #70857 I've noticed that you've added some additional dependencies:
Maybe we should add those in #70857 as well.
Similar here:
Emulator: Path override failed for key ui::DIR_LOCALES and path ...
Emulator: Qt WebEngine resources not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/ ...
No joshuaduong
user on the computer, of course.
I see the issue has been closed and a PR has been merged over a month ago. Is this going to be fixed automatically in a future version of Android Studio?
I'm using the latest one and I got the same error.
Info on my build:
Android Studio 3.5.2
Build #AI-191.8026.42.35.5977832, built on October 30, 2019
JRE: 1.8.0_202-release-1483-b49-5587405 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-66-generic
I see the issue has been closed and a PR has been merged over a month ago. Is this going to be fixed automatically in a future version of Android Studio?
Yes, it should already be fixed (except for 19.03
and older channels).
I'm using the latest one and I got the same error.
@bani the same error as @maxbernyk-vibrato or the error that PR https://github.com/NixOS/nixpkgs/pull/70857 should fix?:
Emulator: /home/alapshin/opt/android-sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
In any case the output of nix run nixpkgs.nix-info -c nix-info -m
and the full log from the Android Emulator (i.e. at least all Emulator:
messages from the Event Log
window) would be helpful. And it might also be relevant if this happens with an Intel or AMD CPU as these issues might be hardware dependent.
And feel free to open a new issue if this isn't related to the missing shared library (libnss3.so
).
@primeos thanks, understood. Now I don't think it's related to the original issue and PR, and I don't even know if it's related to this project. Sorry! I don't have nix installed. It was the same message as @maxbernyk-vibrato, and it only happens the first time I try to interact with one of the buttons on the side of the emulator. It isn't preventing things from working overall.
For reference, I'm using Intel and this is the log:
3:47 PM Install successfully finished in 1 s 90 ms.: App restart successful without requiring a re-install.
3:48 PM Emulator: Qt WebEngine ICU data not found at /usr/local/google/home/joshuaduong/qt-build-5.12.1/install-linux-x86_64/resources. Trying parent directory...
3:48 PM Emulator: Qt WebEngine ICU data not found at /usr/local/google/home/joshuaduong/qt-build-5.12.1/install-linux-x86_64. Trying application directory...
3:48 PM Emulator: Installed Qt WebEngine locales directory not found at location /usr/local/google/home/joshuaduong/qt-build-5.12.1/install-linux-x86_64/translations/qtwebengine_locales. Trying application directory...
3:48 PM Emulator: Qt WebEngine locales directory not found at location /home/bani/code/android/sdk/emulator/lib64/qt/libexec/qtwebengine_locales. Trying fallback directory... Translations MAY NOT not be correct.
3:48 PM Emulator: Path override failed for key ui::DIR_LOCALES and path '/home/bani/.QtWebEngineProcess'
3:48 PM Emulator: Qt WebEngine resources not found at /usr/local/google/home/joshuaduong/qt-build-5.12.1/install-linux-x86_64/resources. Trying parent directory...
3:48 PM Emulator: Qt WebEngine resources not found at /usr/local/google/home/joshuaduong/qt-build-5.12.1/install-linux-x86_64. Trying application directory...
3:48 PM Emulator: [1116/154817.661886:WARNING:resource_bundle_qt.cpp(116)] locale_file_path.empty() for locale
@bani if you don't have Nix installed this is the wrong issue tracker as changes to the Nix package only affect Nix(OS) users (not the upstream Android Studio package from Google or the downstream package of your Linux distribution).
If you're using the official package from the website: https://developer.android.com/studio/
You should be able (IIRC) to create a bug report by selecting Help -> Submit Feedback
(from the menu bar of Android Studio).
If you install Android Studio via your package manager you should probably use your distribution's issue tracker first / contact the maintainer: https://repology.org/project/android-studio/versions
joshuaduong is going to have a field day on his next interview: "Tell me about the last time you ....?"
I'm still getting the same problem with:
Most helpful comment
Similar here:
No
joshuaduong
user on the computer, of course.