Skip to content

Commit f2d5644

Browse files
committed
updating dependencies (ubuntu 20.04, newest sdk tools)
1 parent 18ea01d commit f2d5644

File tree

2 files changed

+33
-26
lines changed

2 files changed

+33
-26
lines changed

Dockerfile

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
11
# Android section of this Dockerfile from https://medium.com/@elye.project/intro-to-docker-building-android-app-cb7fb1b97602
22

3-
FROM ubuntu:16.04
3+
FROM ubuntu:20.04
44

5-
RUN apt-get update
6-
RUN apt-get -y install libegl1-mesa-dev libgles2-mesa-dev libx11-dev
7-
RUN apt-get -y install openjdk-8-jdk openjdk-8-jre
8-
RUN apt-get -y install software-properties-common python-dev && \
9-
apt-get -y install python2.7-dev gdb build-essential libtool autotools-dev libcurl4-openssl-dev curl&& \
10-
apt-get -y install git gcc g++ vim wget ethtool && \
11-
apt-get -y install zlib1g zlib1g-dev devscripts unoconv
5+
RUN apt-get update -q && \
6+
DEBIAN_FRONTEND=noninteractive apt-get install -q -y --no-install-recommends libegl1-mesa-dev libgles2-mesa-dev libx11-dev \
7+
software-properties-common python-dev \
8+
openjdk-8-jdk openjdk-8-jre \
9+
python2.7-dev gdb build-essential libtool autotools-dev libcurl4-openssl-dev curl \
10+
git gcc g++ vim wget ethtool \
11+
zlib1g zlib1g-dev devscripts unoconv unzip && \
12+
apt-get clean
1213

13-
ENV SDK_URL="https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip" \
14+
#ENV SDK_URL="https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip" \
15+
ENV SDK_URL="https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip" \
1416
ANDROID_HOME="/usr/local/android-sdk" \
1517
ANDROID_VERSION=28 \
16-
ANDROID_BUILD_TOOLS_VERSION=28.0.1
18+
ANDROID_BUILD_TOOLS_VERSION=30.0.2
1719

1820
## Download Android SDK
19-
RUN mkdir "$ANDROID_HOME" .android \
20-
&& cd "$ANDROID_HOME" \
21+
RUN mkdir "$ANDROID_HOME" .android "$ANDROID_HOME/cmdline-tools" \
22+
&& cd "$ANDROID_HOME/cmdline-tools" \
2123
&& curl -o sdk.zip $SDK_URL \
2224
&& unzip sdk.zip \
23-
&& rm sdk.zip \
24-
&& yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses
25+
&& rm sdk.zip
26+
RUN yes | $ANDROID_HOME/cmdline-tools/tools/bin/sdkmanager --licenses
2527

2628
## Install Android Build Tool and Libraries
27-
RUN $ANDROID_HOME/tools/bin/sdkmanager --update
28-
RUN $ANDROID_HOME/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" \
29+
RUN $ANDROID_HOME/cmdline-tools/tools/bin/sdkmanager --update
30+
RUN $ANDROID_HOME/cmdline-tools/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" \
2931
"platforms;android-${ANDROID_VERSION}" \
3032
"platform-tools"
3133

3234
# Install NDK
33-
RUN $ANDROID_HOME/tools/bin/sdkmanager "ndk-bundle"
35+
RUN $ANDROID_HOME/cmdline-tools/tools/bin/sdkmanager "ndk-bundle"
3436

3537
# Go section of this Dockerfile from Docker golang: https://github.com/docker-library/golang/blob/master/1.10/alpine3.8/Dockerfile
3638
# Adapted from alpine apk to debian apt
@@ -40,7 +42,8 @@ RUN $ANDROID_HOME/tools/bin/sdkmanager "ndk-bundle"
4042
## - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
4143
RUN echo 'hosts: files dns' > /etc/nsswitch.conf
4244

43-
ENV GOLANG_VERSION 1.10.3
45+
# NOTE: When changing this version take care to also change the chksum below (after wget)
46+
ENV GOLANG_VERSION 1.15.2
4447

4548
RUN set -eux; \
4649
apt-get update; \
@@ -51,6 +54,7 @@ RUN set -eux; \
5154
libssl-dev \
5255
golang \
5356
; \
57+
apt-get clean; \
5458
rm -rf /var/lib/apt/lists/*; \
5559
export \
5660
## set GOROOT_BOOTSTRAP such that we can actually build Go
@@ -71,7 +75,7 @@ RUN set -eux; \
7175
esac; \
7276
\
7377
wget -O go.tgz "https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz"; \
74-
echo '567b1cc66c9704d1c019c50bef946272e911ec6baf244310f87f4e678be155f2 *go.tgz' | sha256sum -c -; \
78+
echo '28bf9d0bcde251011caae230a4a05d917b172ea203f2a62f2c2f9533589d4b4d *go.tgz' | sha256sum -c -; \
7579
tar -C /usr/local -xzf go.tgz; \
7680
rm go.tgz; \
7781
\
@@ -96,8 +100,7 @@ RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" "$GOPATH/pkg" && chmod -R 777 "$GOPATH"
96100

97101
# install gomobile
98102
RUN go get golang.org/x/mobile/cmd/gomobile
99-
RUN gomobile init -ndk $ANDROID_HOME/ndk-bundle/
103+
RUN gomobile init
100104
ADD vimrc /etc/vim/vimrc
101105

102106
WORKDIR /workspace
103-
CMD /bin/bash -c "while true; do sleep 10;done"

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
# License notes
2+
3+
This image is forked from https://github.com/moohoorama/android-go-mobile which by itself was forked from https://github.com/OpenPriv/android-go-mobile.
4+
Thanks for your work which helped a lot :)
5+
16
# Android, Go, and gomobile
27

3-
This image was built for use with Drone CI but can be used with any docker setup you want.
8+
This image was built for use with generic gombile builds for Android.
49

510
This image includes:
611

12+
- based on Ubuntu 20.04
713
- Android SDK, NDK, tools, and API version 28 at `/usr/local/android-sdk`
8-
- Go lang 1.10.3 at `/usr/local/go`
14+
- Go lang 1.15.2 at `/usr/local/go`
915
- $GOPATH set to `/workspace/go`
1016
- A go directory with an initialized gomobile installed at `/go`
1117

@@ -18,10 +24,8 @@ This image comes with gomobile checkedout and preinitialized (time and space con
1824

1925
`cp -as` recreates the directory structure from /go in /workspace/go but for each file, it just creates a symlink. This is the quickest and most efficent way to mirror the work supplied with the image into your workspace.
2026

21-
# Re-arrange docker file
27+
# usage (work in progress)
2228

23-
- Change base image openjdk:8 to ubuntu:16.04
24-
- Install libgl & vim & curl & others
2529
- Build docker image & make .apk
2630
```
2731
docker build . -t android-gomobile

0 commit comments

Comments
 (0)