16

I recently installed Android Studio on arch linux with DWM. But the initial dialog window, which prompts for starting a new project is blank. The links in this windows work though. I can start a new project by blindly clicking where the new project button is supposed to be. There is no problem with the new project wizard, but the editor window which loads up is blank as well.

However, if I start the X server with android studio as the client, It works correctly. So it's an issue with DWM. What could be the reason?

Edit:

Intellij has the same problem with dwm.

saga
  • 1,381
  • 11
  • 36
  • 1
    https://wiki.archlinux.org/index.php/Java#Non-reparenting_window_managers – jasonwryan Jun 14 '17 at 18:10
  • Thanks, setting the variable works but I've run on another issue. I can't set the variable from `.xinitrc`. These are the last two lines of my `.xinitrc`: `export _JAVA_AWT_WM_NONREPARENTING=1 exec $1`. It works if I set the variable in shell startup file – saga Jun 14 '17 at 18:46
  • It should work in `.xinitrc`, but equally will work in your shell profile. – jasonwryan Jun 14 '17 at 19:06
  • yes it should, but it doesn't. That's the problem, I can't export variables from `.xinitrc` – saga Jun 14 '17 at 19:34
  • That is a separate issue. Just put it in your shell profile. – jasonwryan Jun 14 '17 at 19:42

3 Answers3

22

You'll need to set the _JAVA_AWT_WM_NONREPARENTING variable to 1 through some way to Android Studio.

If you're starting dwm via startx, add this to your .xinitrc:

export _JAVA_AWT_WM_NONREPARENTING=1

If you're launching Android Studio from a shell, add the same line to your shell's rc file.

If you're launching Android Studio from a shortcut, and you're not using startx, then you'll have to add the variable to the WM after the process started.

Nolan Akash
  • 383
  • 2
  • 10
  • Report from the future: the solution works also in ratpoison. – peterh Aug 27 '20 at 09:52
  • My session starts `dwm` from `gdm3`, which calls `~/.Xsession` so there is where the export have to be in this case. Previously using `startx` and yes, `~/.xinitrc` is the way. Or `~/.xsessionrc` (Debian and derivatives specific) – Gabriel Alejandro López López Jan 08 '22 at 07:31
3
echo export _JAVA_AWT_WM_NONREPARENTING=1 >> ~/.profile
Robert Karl
  • 131
  • 4
0

I just got it working with _JAVA_AWT_WM_NONREPARENTING=1 and starting android-studio from command line.

android-studio also needs sudo to install components if your android-sdk install is in default from AUR (/opt/android-sdk) and if thats the case just start android-studio with:

sudo _JAVA_AWT_WM_NONREPARENTING=1 android-studio

Just added that as an alias in rofi and good to go :)

Archemar
  • 31,183
  • 18
  • 69
  • 104
arjun
  • 1