-
Notifications
You must be signed in to change notification settings - Fork 1
Updating to Arctic Fox (2020.3.1) Patch 4 #1
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
base: master
Are you sure you want to change the base?
Changes from all commits
ad032ac
c494407
0e27e89
e6e9de3
746aa1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,8 +2,9 @@ Docker container to run Android Studio (https://developer.android.com/studio/ind | |||||
|
|
||||||
| ## Usage | ||||||
|
|
||||||
| ``` | ||||||
| docker run --rm \ | ||||||
| Run Android Studio with the files in the working directory by typing the following command:[^1] | ||||||
| ```bash | ||||||
| docker run -d --rm \ | ||||||
| --privileged \ | ||||||
| -e DISPLAY=${DISPLAY} \ | ||||||
| --device /dev/dri \ | ||||||
|
|
@@ -13,22 +14,50 @@ docker run --rm \ | |||||
| -v /tmp/.X11-unix:/tmp/.X11-unix \ | ||||||
| -v /dev/bus/usb:/dev/bus/usb \ | ||||||
| -v /usr/share/X11/xkb:/usr/share/X11/xkb:ro \ | ||||||
| -v ~/.AndroidStudio:/home/developer/.AndroidStudio \ | ||||||
| -v ~/.AndroidStudio.android:/home/developer/.android \ | ||||||
| -v ~/.AndroidStudio.java:/home/developer/.java \ | ||||||
| -v ~/.AndroidStudio.gradle:/home/developer/.gradle \ | ||||||
| -v ~/.AndroidStudio.sdk:/home/developer/Android/Sdk \ | ||||||
| -v ~/Project:/home/developer/Project \ | ||||||
| --name androidstudio-$(head -c 4 /dev/urandom | xxd -p)-$(date +'%Y%m%d-%H%M%S') \ | ||||||
| rycus86/androidstudio:3.4 | ||||||
| -v ~/.AndroidStudio.config:/home/developer/.config \ | ||||||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line makes the initial configuration of the IDE persistent across restarts. |
||||||
| -v ~/.gradle:/home/developer/.gradle \ | ||||||
| -v ~/Android/:/home/developer/Android/Sdk \ | ||||||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use your own local directory names
Suggested change
|
||||||
| -v "$PWD:/home/developer/Project" \ | ||||||
| --name androidstudio-$(head -c 4 /dev/urandom | xxd -p)-$(date +'%Y%m%d-%H%M%S') \ | ||||||
| chubaoraka/docker-androidstudio | ||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you mean to point this at your DockerHub account?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, because I uploaded the Arctic Fox image on my account.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That makes sense. I'd perhaps propose archiving this repo with some pointers to your repo if you'd be interested in maintaining this image? I no longer do Android dev, so it's unlikely I'll bump this often... What do you think? If you're happy with that, perhaps replace this PR with one that changes the Readme only to clearly point to your repo, and we could get that in (and then I could archive this repo)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good 👍 |
||||||
| ``` | ||||||
|
|
||||||
| Explanation: | ||||||
|
|
||||||
| - `--privileged` - to have access to USB devices connected to the host .AndroidStudio* folders to keep the data on the host between different instances (like SDK tools, AVDs, etc.) | ||||||
| - Local project directories need to be mounted into the container | ||||||
| - The name can be anything - I used something random to be able to start multiple instances if needed | ||||||
| - The `DISPLAY` variable has to be set before running the previous `docker run ...` command withn one of the following commands:[^2] | ||||||
|
|
||||||
| >```bash | ||||||
| >export DISPLAY=host.docker.internal$SCREEN | ||||||
| >``` | ||||||
|
|
||||||
| >or | ||||||
|
|
||||||
| >```bash | ||||||
| >export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}')$SCREEN | ||||||
| >``` | ||||||
|
|
||||||
| >or | ||||||
|
|
||||||
| >```bash | ||||||
| >export DISPLAY=$(ip route | grep default | awk '{print $3}')$SCREEN | ||||||
| >``` | ||||||
|
|
||||||
| - The `SCREEN` variable above depends on the platform on which the command is run. It can be set a using command similar to one of the following (the actual integer value after the colon may defer depending on your setup): | ||||||
|
|
||||||
|
|
||||||
| >```bash | ||||||
| >SCREEN=:0 # Linux | ||||||
| >SCREEN=:0 # WSL on Windows with Xming installed | ||||||
| >SCREEN=:0.0 # WSL on Windows with VcXsrv installed | ||||||
| >``` | ||||||
|
|
||||||
| ## Notes | ||||||
|
|
||||||
| The container has Git installed. It also has Kotlin installed. The container runs as a non-root user but that user is part of the root group to be able to use KVM. When Android Studio starts for the first time it might display a warning about KVM not working but it does actually. | ||||||
|
|
||||||
| [^1]: More about setting the `DISPLAY` variable further in the document. | ||||||
| [^2]: More about setting the `SCREEN` variable further in the document. | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain the reason behind these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the changes are reflective of how the Android Studio binaries are located in my local installation, e.g.
-v ~/.AndroidStudio.sdk:/home/developer/Android/Sdk, so you may overlook or rename accordingly. I found some of the mounts to be unnecessary, like-v ~/.AndroidStudio:/home/developer/.AndroidStudioand-v ~/.AndroidStudio.android:/home/developer/.android. The most important volume mount is-v ~/.AndroidStudio.config:/home/developer/.config, I noticed that it makes the configuration after first startup more persistent.