22 Sep 2019 - tsp
This will be a rather short and not so generic blog-entry.
Since all workstations I’m administering are running FreeBSD and Android Studio (and also every other possible well known development environment for Android) is damanged beyond an easy patch and incapable on running portably on anything else than Linux or MacOS (as well as Windows) - because of binary downloads during the gradle build process and uname checking in aapt2 - and i really didn’t want to switch to Linux just because of this annoyance - there is a solution for that: Run a VM or dedicated machine somewhere else on the network or your local machine and use X11 forwarding. In this case the application looks as it would run on your local machine and normally is as responsive but runs on the remote Linux VM that you just setup to run Android Studio (or any other Linux application).
After standard installation of the development environment on the remote machine (this can be done via SSH and without any graphical environment) one is capable of
desktopfile to add the application to the local application launcher menu.
On most Linux distributions this is enabled in the
sshd_config by default. One
simply has to generate an ssh-key using
ssh-keygen. Just use the default settings
and copy the resulting key onto the remote machine at
Then use ssh-agent (in GUI environments like xfce4 it should already be running if you’ve
installed the system using packages or ports). If it’s not already running launch
ssh-agent. Then one can
ssh-add /path/to/keyfile add the private
key to the local ssh authentication agent.
After that the remote application can be launched with X11 forwarding enabled:
ssh -Y email@example.com "~/android/android-studio/bin/studio.sh"
The application should launch as expected from a local installation.
To get an useable entry in your own application launcher just create an
~/.local/share/application/userapp-AndroidStudioRemote.desktop file. This
could contain the following content:
[Desktop Entry] Type=Application Encoding=UTF-8 Name=Android Studio Exec=ssh -Y firstname.lastname@example.org "~/android/android-studio/bin/studio.sh" Version=Remote on Xen GenericName=Integrated Development Environment Comment=Java, J2EE, Android Terminal=false Categories=Development
ssh-agent is running one can use this shortcut as long as the VM
is also running an reachable.