android-studio-docker icon indicating copy to clipboard operation
android-studio-docker copied to clipboard

ava.awt.AWTError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.

Open Lalarian opened this issue 4 years ago • 5 comments

Hello!

I am trying to run the successfully built IDE using "HOST_NET=1 ./run.sh" on my Manjaro/XFCE system. But I get this error message: java.awt.AWTError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable. at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:65) at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:115) at java.security.AccessController.doPrivileged(Native Method) at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:103) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82) at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:134) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at java.awt.Toolkit$2.run(Toolkit.java:860) at java.awt.Toolkit$2.run(Toolkit.java:855) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854) at com.intellij.ui.AppUIUtil.updateFrameClass(AppUIUtil.java:172) at com.intellij.idea.StartupUtil.prepareAndStart(StartupUtil.java:113) at com.intellij.idea.MainImpl.start(MainImpl.java:20) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.ide.plugins.PluginManager.lambda$start$0(PluginManager.java:76) at java.lang.Thread.run(Thread.java:748)

Can you help me with this? Thank you! :)

Lalarian avatar Sep 20 '21 08:09 Lalarian

Hi @Lalarian,

if you want something to show please use

HOST_DISPLAY=1 as described in the "Run" section. Hope this helps.

Happy coding,

Deadolus

Deadolus avatar Sep 20 '21 09:09 Deadolus

Oops, sorry! Of course I was using "HOST_DISPLAY=1 ./run.sh". I just switched the words in the first post.

Lalarian avatar Sep 20 '21 09:09 Lalarian

Hmm, this makes the problem a bit more interesting. The Android-Studio in the docker wants to connect to your ':0.0' display, but does not find it. Is your display really on :0.0? Check the DISPLAY variable. The Container also forwards your /tmp/.X11-unix - does this file exist on your system (it seems to me it should on xfce)? Pleae also check the permission of this file.

Deadolus avatar Sep 21 '21 07:09 Deadolus

Hello! The .X11-unix folder does exists with onlye one file "X0" in it. The X0 file has 777 permissions, but I can't open or read it:

[ladmin@elite/tmp/.X11-unix]ls -al /tmp/.X11-unix/X0 srwxrwxrwx 1 root root 0 20. Sep 11:12 /tmp/.X11-unix/X0 [ladmin@elite/tmp/.X11-unix]ls -al /tmp/.X11-unix/ insgesamt 0 drwxrwxrwt 2 root root 60 20. Sep 11:12 . drwxrwxrwt 16 root root 500 21. Sep 11:14 .. srwxrwxrwx 1 root root 0 20. Sep 11:12 X0 [ladmin@elite/tmp/.X11-unix]cat /tmp/.X11-unix/X0 cat: /tmp/.X11-unix/X0: Kein passendes Gerät bzw. keine passende Adresse gefunden

The DISPLAY variable is what we have gotten as response before:

[ladmin@elite/tmp/.X11-unix]echo $DISPLAY :0.0

Lalarian avatar Sep 21 '21 09:09 Lalarian

Running into this same problem on my arch linux system. Did you find a solution by any chance?

ggalmeida0 avatar Dec 23 '21 03:12 ggalmeida0

Hi, try to run the command xhost +

guilhermelinhares avatar Oct 10 '22 15:10 guilhermelinhares

After trying various methods to no avail, I found that the cause of the problem was due to my use of Docker Desktop, which uses kvm-qemu for virtualization, and therefore could not connect to the host's x11.This problem was solved when I used the default Docker Engine.

Ac-Accelerator avatar Sep 17 '23 07:09 Ac-Accelerator