Skip to content

Create APK feature

  • Package docker image with android/expo build tools
  • Modify expo template to remove:
    • Analytics libraries
    • [ ] All unused libraries
  • Add apprentice build mobile command to launch the docker tool

Manual APK creation instructions with Docker

Here are instructions to create a signed APK with the apprentice CLI and using Docker under the hood.

Prerequisites

Make sure you have up to date tools:

  • npm i -g docsmith@beta
  • npm i -g activist-apprentice
  • npm i -g exp

Update the lesson project with the latest version of the mobile packages:

cd ~/.content/packages/activist-apprentice-course-template
npm i --save contentascode-mobile@0.2.1
npm i --save metalsmith-contentascode-mobile@0.0.10

Initial Setup

These instructions only need to be followed the first time an APK is generated.

  1. First install Docker [https://docs.docker.com/docker-for-mac/install/][]

  2. Then make sure that you set Docker to minimum 4GB memory (Docker icon > Preferences > Advanced).

  3. Create a keystore and key to sign your application.

cd ~/workspace # Or another secure place to store your keystore
docker run -it -v $(pwd)/keys:/keys iilab/android:24.1.1 bash -c "keytool -genkey -v -keystore /keys/my-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-key-alias"

Build APK

  1. Either:
  • Commit and push the updated project to gitlab in order for the project to be published to expo (check that the pipelines on gitlab finish successfully):
git add .
git commit -m "Updated contentascode mobile packages"
git push
  • Or publish directly from your local development computer with
cd ~/.content/build/@apprentice/mobile
exp publish
  1. Build the mobile project APK (replacing the project url, keystore location and key alias with yours):
cd ~/workspace # (change this to where your content as code workspace is located)
apprentice build mobile --project @iilab/safely-securely-producing-media --keystore_path $(pwd)/keys/my-keystore.jks --key_alias my-key-alias mobile # This launches the docker based apk creation

You will be prompted to enter your keystore and key alias passwords.

On first run, the apprentice build mobile command will download the docker container which can take a while.

After this you should have an apk called safely-securing-producing-media.apk inside the build folder in your workspace. You can drag and drop this into RepoMaker.

Edited by Jun Matsushita