1
0
android-container/README.md
James Ketrenos 7821ec13bd Misc doc updates
Signed-off-by: James Ketrenos <james.p.ketrenos@intel.com>
2025-01-04 15:03:46 -08:00

178 lines
3.6 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 development container environment
The following steps will set up an Android build environment:
1. Seed `android-sdk-manager` container with an initial version of the Android
SDK:
```bash
docker compose build
```
This will build the base 'android-sdk-manager' container as well create an unseeded 'android-dev-container'.
2. Transfer the AndroidSDK from `android-sdk-manager` to the host:
Copy the sdk from the android-sdk-manager to the host to allow multiple
containers to use the same base SDK, as well as to perform SDK updates,
upgrades, and additional package installations.
```bash
docker compose run -it --rm \
-v $(realpath AndroidSDK):/sdk:rw \
-v $(realpath scripts):/scripts:rw \
android-sdk-manager \
init
```
3. Install packages into SDK
The `android-sdk-manager` container can then be used to update then
`./AndroidSDK` on the host to include additional packages.
The following will install Android platform 35:
```bash
ANDROID_PLATFORM=35
docker compose run -it --rm \
-v $(realpath AndroidSDK):/opt/android-sdk:rw \
-v $(realpath scripts):/scripts:rw \
android-sdk-manager -- \
sdkmanager \
"build-tools;${ANDROID_PLATFORM}.0.0" \
"platforms;android-${ANDROID_PLATFORM}" \
"platform-tools"
```
At this point, `./AndroidSDK` contains the latest SDK with the requested Android Platform version.
## Seed a 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}"
```
# Things
To use virtual devices:
## Build Eikona
```bash
./launch.sh eikona
./shell.sh eikona
./build.sh debug # release, or empty
```
## Install base image
```
sdkmanager "system-images;android-35-ext14;google_apis_playstore;x86_64"
```
## Create virtual device
```
avdmanager create avd \
-n Pixel \
-d pixel_6a \
-k "system-images;android-35-ext14;google_apis_playstore;x86_64"
```
# Emulator
## Run the emulator
Launch the development container
```bash
./launch.sh eikona
```
Once the emulator is launched (see below), select the device (shift-a) then switch to debug build (s) and finally open the app (a).
## Launch the emulator
```bash
./shell.sh eikona
./emulator.sh Pixel
```
## Install the app
```bash
./shell.sh eikona
./install.sh debug # or release -- default debug
```
# Add a new component
## Shell in and add component
```bash
./shell.sh eikona
npx expo install react-pdf-viewer
```
### To remove
```bash
./shell.sh eikona
npm remove react-pdf-viewer
```
## Build the app
While in the shell previously launched, run the 'build' script:
```bash
./shell.sh eikona
./build.sh debug # release
```
# Update the application launcher icon
Go to https://easyappicon.com/, drag the adaptive-icon.png to the app, reduce
padding to -100%, then save.
Copy the ic-launcher/android/* files to android/app/src/main/res/
Rebuild the application.