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

android-studio: add new emulator dependencies #70857

Merged
merged 1 commit into from Oct 11, 2019

Conversation

alexbakker
Copy link
Member

Motivation for this change

Android emulator has gotten a few new dependencies. Without those present, it won't start.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @primeos

@primeos
Copy link
Member

primeos commented Oct 9, 2019

If anyone could help test this that would be much appreciated :)

Unfortunately I don't have a test setup for the emulator atm (in the worst-case I can try to figure something out at the weekend) :o

@alexbakker thank you very much for the PR. The changes LGTM, but as stated above I can unfortunately not test/verify them atm. And as noted in #70844 (comment) we might have to add dbus and libxcb as well, though I assume that those are optional (given that this worked on your setup).

@alapshin
Copy link
Contributor

alapshin commented Oct 10, 2019

dbus and libxcb are needed if we want to use emulator toolbar, without them emulator crashes if we press any toolbar button. However it is not enough by itself there are missing qt dependencies/resources that cause crash (see original issue #70844 for stacktrace). I tried to add qtbase and qtwebengine to LD_LIBRARY_PATH but it didn't help. Probably need to specify path to qtwebengine's resources, but I'm not sure how.

@alexbakker
Copy link
Member Author

Ah, my bad. I had not tried to use the toolbar. I'll take another crack at this tonight.

@alapshin
Copy link
Contributor

alapshin commented Oct 10, 2019

My bad, toolbar crash seems to be unrelated to Qt warnings. Instead we need to add libudev. In the end full diff looks like this:

diff --git b/pkgs/android-studio/common.nix a/pkgs/android-studio/common.nix
index 0d406ad..7a9be9d 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
@@ -18,13 +21,21 @@
 , freetype
 , libpulseaudio
 , libGL
+, libudev
 , libX11
+, libxcb
+, libXcomposite
+, libXcursor
+, libXdamage
 , libXext
+, libXfixes
 , libXi
 , libXrandr
 , libXrender
 , libXtst
 , makeWrapper
+, nspr
+, nss
 , pciutils
 , pkgsi686Linux
 , setxkbmap
@@ -99,9 +110,20 @@ let
           libXrandr
 
           # For Android emulator
+          alsaLib
+          dbus
+          expat
           libpulseaudio
-          libX11
           libGL
+          libudev
+          libX11
+          libxcb
+          libXcomposite
+          libXcursor
+          libXdamage
+          libXfixes
+          nspr
+          nss
 
           # For GTKLookAndFeel
           gtk2

After that emulator seems to work fine including toolbar actions and settings. There are still some warnings in console but I think they can be addressed later.

6:28 AM	Emulator: Warning: QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled ((null):0, (null))
6:28 AM	Emulator: emulator: ERROR: VkCommonOperations.cpp:496: Failed to create Vulkan instance.
6:28 AM	Emulator: Warning: restoring GLES1 context from snapshot. App may need reloading.
6:28 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...
6:28 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...
6:28 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...
6:28 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.
6:28 AM	Emulator: Path override failed for key ui::DIR_LOCALES and path '/home/alapshin/.QtWebEngineProcess'
6:28 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...
6:28 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...
6:28 AM	Emulator: [1010/092824.519651:WARNING:resource_bundle_qt.cpp(116)] locale_file_path.empty() for locale

@alexbakker
Copy link
Member Author

Nice! I'll update my PR with your patch tonight. If you want to beat me to it and submit a PR that supersedes this one, that's fine by me too.

@alexbakker
Copy link
Member Author

I've added dbus, libxcb and libudev to the list of dependencies and confirmed that the emulator toolbar can be used without crashing Android Studio.

@primeos primeos merged commit a7e87bc into NixOS:master Oct 11, 2019
@primeos
Copy link
Member

primeos commented Oct 11, 2019

Thanks @alexbakker and @alapshin :)

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/android-studio-emulator-not-working/4316/2

primeos pushed a commit to primeos/nixpkgs that referenced this pull request Oct 11, 2019
Fix NixOS#70844.

(cherry picked from commit a7e87bc)
Reason: Should be required for newer emulator versions on 19.09 as well.
primeos added a commit that referenced this pull request Oct 11, 2019
[19.09] android-studio: add new emulator dependencies (#70857)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants