86 lines
2.1 KiB
Markdown
86 lines
2.1 KiB
Markdown
# Android Development Container
|
|
|
|
This sets up development containers for Expo and Flutter using
|
|
the Android SDK. The Dockerfile is derived from parts of [thyrlian/android-sdk](https://github.com/thyrlian/AndroidSDK), with expo and flutter development
|
|
infrastructure configured as well.
|
|
|
|
## Build the Android SDK base container
|
|
|
|
This will seed the base container with an initial version of the Android SDK.
|
|
|
|
```bash
|
|
docker compose build
|
|
```
|
|
|
|
This will build the base 'android-sdk-manager' container as well as the unseeded
|
|
'android-dev-container'.
|
|
|
|
Inside the 'anrdoid-sdk-manager' container the directory '/sdk' will contain the original SDK.
|
|
|
|
After it is created, the SDK is copied to a volume bind mount on the host to
|
|
allow multiple containers to use the same base SDK, as well as to perform
|
|
SDK updates, upgrades, and additional package installations. The initial
|
|
seeding of the AndroidSDK on the host is performed via:
|
|
|
|
```bash
|
|
docker compose run -it --rm \
|
|
android-sdk-manager \
|
|
init
|
|
```
|
|
|
|
## Install packages into SDK
|
|
|
|
The following will install Android platform 34:
|
|
|
|
https://docs.flutter.dev/get-started/install/linux/android?tab=physical#configure-android-development
|
|
|
|
```bash
|
|
docker compose run -it --rm \
|
|
android-sdk-manager -- \
|
|
sdkmanager \
|
|
"emulator" \
|
|
"cmdline-tools;latest" \
|
|
"build-tools;34.0.0" \
|
|
"platforms;android-34" \
|
|
"platform-tools" \
|
|
"system-images;android-34;google_apis_playstore;x86_64"
|
|
```
|
|
|
|
At this point, ./AndroidSDK contains the latest SDK. The docker-compose.yml
|
|
for the android-dev-container will mount ./AndroidSDK to /opt/android-sdk.
|
|
|
|
## Seed the flutter repository
|
|
|
|
```
|
|
git clone https://github.com/flutter/flutter.git
|
|
```
|
|
|
|
## To seed a new project (once per project)
|
|
|
|
```bash
|
|
PROJECT=foo
|
|
PROJECT_TYPE=expo # flutter
|
|
./seed.sh "${PROJECT_TYPE}" "${PROJECT}"
|
|
```
|
|
|
|
## To develop
|
|
|
|
```bash
|
|
PROJECT=foo
|
|
PROJECT_TYPE=expo
|
|
./develop.sh "${PROJECT_TYPE}" "${PROJECT}"
|
|
```
|
|
|
|
## To access the shell of the running project
|
|
|
|
```bash
|
|
PROJECT=foo
|
|
./shell.sh "${PROJECT}"
|
|
```
|
|
|
|
## To stop development container
|
|
|
|
```bash
|
|
docker compose stop "${PROJECT}"
|
|
```
|