| 1 | # Building Cake Wallet for Android |
| 2 | |
| 3 | ## Requirements and Setup |
| 4 | |
| 5 | As we use Docker with a custom Dockerfile to build Cake Wallet, the only dependency for building Cake on your local host is the Docker Engine. |
| 6 | |
| 7 | You can find the latest instructions for installing Docker on your given OS on the official website: |
| 8 | |
| 9 | - <https://docs.docker.com/engine/install/> |
| 10 | |
| 11 | ## Building Cake Wallet or Monero.com |
| 12 | |
| 13 | ### Using the pre-built builder image |
| 14 | |
| 15 | In order to build the latest version of Cake Wallet, simply run the following: |
| 16 | |
| 17 | ```bash |
| 18 | git clone --branch main https://github.com/cake-tech/cake_wallet.git |
| 19 | # NOTE: Replace `main` with the latest release tag available at https://github.com/cake-tech/cake_wallet/releases/latest. |
| 20 | cd cake_wallet |
| 21 | # docker build -t ghcr.io/cake-tech/cake_wallet:debian13-flutter3.41.9-ndkr28-go1.24.1-ruststablenightly . # Uncomment to build the docker image yourself instead of pulling it from the registry |
| 22 | docker run -v$(pwd):$(pwd) -w $(pwd) -i --rm ghcr.io/cake-tech/cake_wallet:debian13-flutter3.41.9-ndkr28-go1.24.1-ruststablenightly bash -x << EOF |
| 23 | set -x -e |
| 24 | git config --global --add safe.directory '*' |
| 25 | pushd scripts/android |
| 26 | ./build_torch.sh # optional: this will fail on case-insensitive fs and will add extra few hours to the build process, without this embedded tor will not work. |
| 27 | ./build_reown_deps.sh |
| 28 | pushd .. |
| 29 | ./build_bitbox_flutter.sh |
| 30 | popd |
| 31 | source ./app_env.sh cakewallet |
| 32 | # source ./app_env.sh monero.com # Uncomment this line to build monero.com |
| 33 | ./app_config.sh |
| 34 | ./build_monero_all.sh # optional, ommit to not build monero |
| 35 | ./build_decred.sh |
| 36 | ./build_mwebd.sh |
| 37 | ./build_zcash.sh |
| 38 | popd |
| 39 | pushd android/app |
| 40 | [[ -f key.jks ]] || keytool -genkey -v -keystore key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias testKey -noprompt -dname "CN=CakeWallet, OU=CakeWallet, O=CakeWallet, L=Florida, S=America, C=USA" -storepass hunter1 -keypass hunter1 |
| 41 | popd |
| 42 | flutter clean |
| 43 | ./model_generator.sh |
| 44 | dart run tool/generate_android_key_properties.dart keyAlias=testKey storeFile=key.jks storePassword=hunter1 keyPassword=hunter1 |
| 45 | dart run tool/generate_localization.dart |
| 46 | dart run tool/generate_new_secrets.dart |
| 47 | flutter build apk --release --split-per-abi |
| 48 | EOF |
| 49 | ``` |
| 50 | |
| 51 | You should see the command complete with similar output: |
| 52 | |
| 53 | ```bash |
| 54 | Running Gradle task 'assembleRelease'... 519.1s |
| 55 | ✓ Built build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk (56.3MB) |
| 56 | ✓ Built build/app/outputs/flutter-apk/app-arm64-v8a-release.apk (55.8MB) |
| 57 | ✓ Built build/app/outputs/flutter-apk/app-x86_64-release.apk (56.4MB) |
| 58 | ``` |
| 59 | |
| 60 | Final builds can be found in `build/app/outputs/flutter-apk/` as seen above. |
| 61 | |
| 62 | ## Signing builds |
| 63 | |
| 64 | While properly signing builds is outside of the scope of this guide (very few users want or need to run their own built APKs), to learn more about how to sign APKs you can check out the Zeus team's fantastic guide: |
| 65 | |
| 66 | - <https://github.com/ZeusLN/zeus/blob/master/docs/ReproducibleBuilds.md#signing-apks> |