using - phlummox/android-studio-docker GitHub Wiki

Using android-studio-docker

  • Go to https://gitpod.io/#https://github.com/phlummox/android-studio-docker

    You should see Gitpod building the Docker image it needs in order to run Android Studio:

    using_images/building-workspace-image.png

    May take a few minutes, if it hasn't been recently built prior.
     

  • Eventually it should build, and you should see something like this:

    using_images/running-gitpod.svg

    This is Gitpod running Theia, a cloud-based IDE which borrows its design heavily from Microsoft's VS Code (and in fact, can even run VS Code extensions).
     

  • We won't be using it. (Though some of the menus are worth investigating -- they let you do things like, e.g., download files from the IDE workspace to your computer.)
     

  • Instead, go to the pop up message that says "A service is available on port 6080", in the lower right corner, and click on "Open Browser".

    Gitpod is running a full X Window session and a VNC server, and makes this available via port 6080. (VNC users might recognize port 5900 as being the usual server port for VNC -- but the VNC server is running inside a docker container, and from outside the container, the server is accessible in port 6080.)

    When you click on the button, a new browser tab should open up, showing the desktop manager for this X Window session.

    using_images/x-window-session.svg
     

  • Which is mostly black. The desktop manager being used is OpenBox, which starts off with a rather minimal desktop.

    But if you right-click, you should see a context menu with a "Terminal emulator" menu item -- click it to bring up an xterm window.
     

  • In the terminal window, type android_studio and hit return, and Android Studio should start.
     


     

  • From here, you can select "Start a new Android Studio Project", and, after a couple of configuration screens, your new project will be open in Android Studio.
     


     

  • Note that you can't emulate an Android device - from within a Docker container, that requires privileged access to the host's resources, which we don't have - but you can build projects, export them as .zip files, and so on.

  • Gitpod will eventually delete your workspace (including any Android Studio plugins you've installed/updated, Android SDKs you've installed, etc.)

    If you want to persist this information somewhere, you'll need to save the files sitting under /home/gitpod/.android, /home/gitpod/Android, and /home/gitpod/.AndroidStudio4.0. (In toto, usually around a GB or so.)