Skip to content
Dockerfile for building Android projects inside a container.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
build separate /build dir from /src dir for better image build isolation Jun 10, 2019
src rename .gitkeep to better indicate the purpose of /src dir Jun 12, 2019
.gitignore
LICENSE
README.md

README.md

Android Docker

Dockerfile for building Android projects inside a container. Contains Android SDK and NDK. Based on Ubuntu LTS for maximum compatiblity.

Building

Following commands assume that your project source code is at /src of this repo, and your project's Gradle wrapper executable is located at /src/gradlew.

# build Docker image first
docker build -f build/Dockerfile -t android-docker .

# now build the Android project using Gradle wrapper
docker run -it --rm -v src:/root/build android-docker ./gradlew build

After a successful build, all build artficats will be in their respective locations as if you built the project natively on your computer.

Testing

It's best to use a device farm to test your app on real devices, i.e. Firebase Test Lab However if you want to test your app in an emulator inside a container, check the following resources:

Security Note

While building the image, Dockerfile scripts only have access to files residing in the /build directory for security reasons. If you need any file from /src directory during image build, you should copy them to /build directory. Note that this is only true during image building process. Running container will have full access to /src directory.

You can’t perform that action at this time.