Open emanuelb opened 2 years ago
How is progress on this? How can we compile this app?
Why was this issue closed without any investigation or explanation? I'm concerned that the APK was demonstrably NOT reproducible.
Hi, was a mistake to close this issue without a resolution.... as this issue was from 2 years ago, the build guide has been updated since then and I believe this is what you need:
Generate mobx models for cw_haven:
cd cw_haven && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd ..
Please have a look the current build guide and try building the latest main or version tag: https://github.com/cake-tech/cake_wallet/blob/main/howto-build-android.md
For discussion on 1 to 1 binary reproduceability, https://github.com/cake-tech/cake_wallet/issues/112 and https://github.com/cake-tech/cake_wallet/issues/338 will still be open.
Let us know if you have any other build questions :smiley:
Thanks @tuxpizza
@emanuelb Even though the Cake team hasn't seemed too concerned about it in the last few years, for the sake of the larger community I hope this package can be reevaluated on WalletScrutiny!
Cool. In relation to current attempts by WalletScrutiny to re-verify apps, I'm opening an issue for walletscrutiny.com again. Hopefully, this app can be verified.
The issue is here: https://gitlab.com/walletscrutiny/walletScrutinyCom/-/issues/537
We have our plates full though - so if anybody would like to boost the spirit of Open Source, you are most welcome to build this app.
Hi, I tried to build the latest version, 4.19.1
and ran into some errors.
FROM ubuntu:20.04
# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive
# Install required packages
RUN apt-get update && apt-get install -y \
wget \
curl \
unzip \
automake \
build-essential \
file \
pkg-config \
git \
python \
libtool \
libtinfo5 \
cmake \
openjdk-8-jre-headless \
clang
# Install Android SDK and NDK
ENV ANDROID_SDK_ROOT /opt/android-sdk
ENV ANDROID_NDK_ROOT /opt/android-ndk
ENV ANDROID_HOME ${ANDROID_SDK_ROOT}
ENV PATH ${PATH}:${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin:${ANDROID_SDK_ROOT}/platform-tools:${ANDROID_NDK_ROOT}
RUN mkdir -p ${ANDROID_SDK_ROOT}/cmdline-tools && \
wget -q https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip -O android-sdk.zip && \
unzip -q android-sdk.zip -d ${ANDROID_SDK_ROOT}/cmdline-tools && \
mv ${ANDROID_SDK_ROOT}/cmdline-tools/cmdline-tools ${ANDROID_SDK_ROOT}/cmdline-tools/latest && \
rm android-sdk.zip && \
yes | ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --sdk_root=${ANDROID_SDK_ROOT} "platform-tools" "platforms;android-33" "build-tools;33.0.0" && \
wget -q https://dl.google.com/android/repository/android-ndk-r17c-linux-x86_64.zip -O android-ndk.zip && \
unzip -q android-ndk.zip -d /opt && \
mv /opt/android-ndk-r17c ${ANDROID_NDK_ROOT} && \
rm android-ndk.zip
# Install Flutter
ENV FLUTTER_ROOT /opt/flutter
ENV PATH ${PATH}:${FLUTTER_ROOT}/bin
RUN git clone https://github.com/flutter/flutter.git -b stable ${FLUTTER_ROOT} && \
flutter doctor
# Install rustup
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# Set up working directory
WORKDIR /app
# Clone Cake Wallet repository with the specific tag
RUN git clone https://github.com/cake-tech/cake_wallet.git . && \
git fetch --all --tags && \
git checkout tags/v4.19.1
# Generate keystore file
RUN keytool -genkey -v -keystore /root/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key -storepass your_store_password -keypass your_key_password -dname "CN=Your Name, OU=Your Organizational Unit, O=Your Organization, L=Your City, S=Your State, C=Your Country Code"
# Remove pubspec.lock to avoid conflicts
RUN find . -name pubspec.lock -exec rm -f {} \;
# Modify pubspec.yaml to fix intl dependency issue (more flexible regex)
RUN find . -name pubspec.yaml -print -exec sed -i 's/intl:.*$/intl: 0.19.0/' {} \; && \
echo "pubspec.yaml files updated" && \
grep -R "intl: 0.19.0" . || echo "Failed to update intl version"
# Set environment variables for the build
ENV ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}
ENV ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT}
ENV PATH=${PATH}:${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin:${ANDROID_SDK_ROOT}/platform-tools:${ANDROID_NDK_ROOT}
# Build Cake Wallet
RUN mkdir -p /opt/android && \
cd scripts/android && \
echo "Current directory: $(pwd)" && \
ls -la && \
./install_ndk.sh && \
bash -c "set -x && source ./app_env.sh cakewallet && \
./app_config.sh && \
echo 'Content of build_haven.sh:' && cat build_haven.sh && \
./build_all.sh" && \
cd ../../ && \
flutter pub get && \
flutter pub upgrade --major-versions && \
flutter packages pub run tool/generate_new_secrets.dart && \
flutter packages pub run tool/generate_android_key_properties.dart keyAlias=key storeFile=/root/key.jks storePassword=your_store_password keyPassword=your_key_password && \
flutter packages pub run tool/generate_localization.dart && \
./model_generator.sh && \
flutter build apk --release
# The APK will be located at /app/build/app/outputs/flutter-apk/app-release.apk
# Add SHA256 checksums for verification
RUN echo "4324fe3ee56762c012135884ff3ac99c7194ffaeabcb26d9359316fc2e0d1426 /app/build/app/outputs/flutter-apk/app-release.apk" > /app/checksums.txt && \
sha256sum -c /app/checksums.txt
# Add release notes
RUN echo "Cake Wallet v4.19.1 Release Notes:" > /app/release_notes.txt && \
echo "* Monero and Ethereum enhancements" >> /app/release_notes.txt && \
echo "* Synchronization improvements" >> /app/release_notes.txt && \
echo "* Exchange flow enhancements" >> /app/release_notes.txt && \
echo "* Ledger improvements" >> /app/release_notes.txt && \
echo "* Bug fixes" >> /app/release_notes.txt
This is the dockerfile i created. this follows the build instructions provided in the howto-build-android.md
. I faced this error
Resolving dependencies...
Note: intl is pinned to version 0.19.0 by flutter_localizations from the flutter SDK.
See https://dart.dev/go/sdk-version-pinning for details.
Because cake_wallet depends on flutter_localizations from sdk which depends on intl 0.19.0, intl 0.19.0 is required.
So, because cake_wallet depends on intl ^0.18.0, version solving failed.
You can try the following suggestion to make the pubspec resolve:
* Try an upgrade of your constraints: flutter pub upgrade --major-versions
The command '/bin/sh -c mkdir -p /opt/android && cd scripts/android && ./install_ndk.sh && bash -c "source ./app_env.sh cakewallet && ./app_config.sh && ./build_all.sh" && cd ../../ && flutter pub get && flutter pub upgrade --major-versions && flutter packages pub run tool/generate_new_secrets.dart && flutter packages pub run tool/generate_android_key_properties.dart keyAlias=key storeFile=/root/key.jks storePassword=your_store_password keyPassword=your_key_password && flutter packages pub run tool/generate_localization.dart && ./model_generator.sh && flutter build apk --release' returned a non-zero code: 1
It is in my understanding a dependency conflict, which arises due to flutter_localizations requiring intl version 0.19.0, while cake_wallet depends on intl version ^0.18.0. This version conflict causes the resolution process to fail. I tried to fix this by manually finding and fixing the file:
# Remove pubspec.lock to avoid conflicts
RUN find . -name pubspec.lock -exec rm -f {} \;
# Modify pubspec.yaml to fix intl dependency issue (more flexible regex)
RUN find . -name pubspec.yaml -print -exec sed -i 's/intl:.*$/intl: 0.19.0/' {} \; && \
echo "pubspec.yaml files updated" && \
grep -R "intl: 0.19.0" . || echo "Failed to update intl version"
but sadly that didn't work. I also tried deleting the pubspec.lock so it can be generated later, but that also didn't work. Any idea or suggestion on what to do next on this?
Hello, I wrote a new working docker as of last commit b8ffd47 compiling a working APK I believe v4.20.1 is building and working fine,
Building logs here, Dockerfile here
Commented lines for easy env fill
# <----- how to run ----->
# mkdir build
# docker build -f cakeRELEASE.Dockerfile -t cake .
# docker create -it --name cake cake bash
# docker cp cake:/build/. build/
# Base image with Flutter
FROM instrumentisto/flutter:3.19.6
# Set environment variables
ENV STORE_PASS=test@cake_wallet \
KEY_PASS=test@cake_wallet \
ANDROID_ROOT=/usr/local/lib/android \
ANDROID_SDK_ROOT=/usr/local/lib/android/sdk \
ANDROID_HOME=/usr/local/lib/android/sdk \
ANDROID_NDK_HOME=/usr/local/lib/android/sdk/ndk/27.1.12297006 \
ANDROID_NDK_ROOT=/usr/local/lib/android/sdk/ndk/27.1.12297006 \
ANDROID_NDK=/usr/local/lib/android/sdk/ndk/27.1.12297006 \
PATH=$PATH:/usr/local/lib/android/sdk/cmdline-tools/latest/bin:/usr/local/lib/android/sdk/platform-tools
SHELL ["/bin/bash", "-c"]
# Install dependencies
RUN apt update && \
apt-get install -y \
curl \
unzip \
automake \
build-essential \
autoconf \
file \
pkg-config \
git \
python-is-python3 \
libtool \
libtinfo5 \
make \
gcc \
g++ \
lbzip2 \
cmake \
ccache \
gperf \
openjdk-8-jre-headless \
clang
# Install Android SDK components
RUN rm -rf /opt/android-sdk-linux && \
mkdir -p $ANDROID_SDK_ROOT/cmdline-tools && \
curl -o commandlinetools.zip -L https://dl.google.com/android/repository/commandlinetools-linux-9123335_latest.zip && \
unzip -qq commandlinetools.zip -d $ANDROID_SDK_ROOT/cmdline-tools && \
mv $ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools $ANDROID_SDK_ROOT/cmdline-tools/latest && \
rm commandlinetools.zip && \
yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses && \
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager \
"platform-tools" \
"platforms;android-30" \
"build-tools;30.0.3" \
"ndk;27.1.12297006" && \
chmod -R a+rwx $ANDROID_SDK_ROOT
# Set up Android environment
RUN mkdir -p /opt/android && \
cd /opt/android && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
. "$HOME/.cargo/env" && \
cargo install cargo-ndk && \
git clone https://github.com/cake-tech/cake_wallet.git && \
cd cake_wallet/scripts/android/ && \
./install_ndk.sh && \
source ./app_env.sh cakewallet && \
chmod +x pubspec_gen.sh && \
./app_config.sh && \
git config --global --add safe.directory '*' && \
git config --global user.email "test@caketest.com" && \
git config --global user.name "Docker Build Test"
# Build mwebd
RUN wget https://go.dev/dl/go1.23.1.linux-amd64.tar.gz && \
rm -rf /usr/local/go && \
tar -C /usr/local -xzf go1.23.1.linux-amd64.tar.gz && \
export PATH=$PATH:/usr/local/go/bin && \
go install golang.org/x/mobile/cmd/gomobile@latest && \
export PATH=$PATH:~/go/bin && \
gomobile init && \
cd /opt/android/cake_wallet/scripts/android/ && \
./build_mwebd.sh --dont-install
# Build binaries (this step may take a while)
# RUN cd /opt/android/cake_wallet/scripts/android/ && \
# bash -c "set -x && source ./app_env.sh cakewallet && \
# echo 'BUILDING BINS:' && \
# ./build_monero_all.sh"
# Fetch Flutter dependencies
# download pre-Built binaries
# keystore + Localization + model
RUN cd /opt/android/cake_wallet && \
flutter pub get && \
flutter packages pub run tool/download_moneroc_prebuilds.dart && \
cd /opt/android/cake_wallet/android/app && \
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 $STORE_PASS -keypass $KEY_PASS && \
cd /opt/android/cake_wallet && \
flutter packages pub run tool/generate_android_key_properties.dart \
keyAlias=testKey storeFile=key.jks storePassword=$STORE_PASS keyPassword=$KEY_PASS && \
flutter packages pub run tool/generate_localization.dart && \
flutter packages pub run tool/generate_new_secrets.dart && \
./model_generator.sh
# ---- Add Secrets with Placeholders ----
# RUN cd /opt/android/cake_wallet && \
# touch lib/.secrets.g.dart && \
# touch cw_evm/lib/.secrets.g.dart && \
# touch cw_solana/lib/.secrets.g.dart && \
# touch cw_core/lib/.secrets.g.dart && \
# touch cw_nano/lib/.secrets.g.dart && \
# touch cw_tron/lib/.secrets.g.dart && \
# echo "const salt = '00000000000000000000000000000000';" > lib/.secrets.g.dart && \
# echo "const keychainSalt = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const key = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const walletSalt = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const shortKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const backupSalt = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const backupKeychainSalt = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const changeNowApiKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const changeNowApiKeyDesktop = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const wyreSecretKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const wyreApiKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const wyreAccountId = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const moonPayApiKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const moonPaySecretKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const sideShiftAffiliateId = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const simpleSwapApiKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const simpleSwapApiKeyDesktop = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const onramperApiKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const anypayToken = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const ioniaClientId = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const twitterBearerToken = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const trocadorApiKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const trocadorExchangeMarkup = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const anonPayReferralCode = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const fiatApiKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const payfuraApiKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const ankrApiKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const etherScanApiKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const polygonScanApiKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const etherScanApiKey = '00000000000000000000000000000000';" >> cw_evm/lib/.secrets.g.dart && \
# echo "const moralisApiKey = '00000000000000000000000000000000';" >> cw_evm/lib/.secrets.g.dart && \
# echo "const chatwootWebsiteToken = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const exolixApiKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const robinhoodApplicationId = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const exchangeHelperApiKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const walletConnectProjectId = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const moralisApiKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const polygonScanApiKey = '00000000000000000000000000000000';" >> cw_evm/lib/.secrets.g.dart && \
# echo "const ankrApiKey = '00000000000000000000000000000000';" >> cw_solana/lib/.secrets.g.dart && \
# echo "const testCakePayApiKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const cakePayApiKey = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const authorization = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const CSRFToken = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const quantexExchangeMarkup = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const nano2ApiKey = '00000000000000000000000000000000';" >> cw_nano/lib/.secrets.g.dart && \
# echo "const nanoNowNodesApiKey = '00000000000000000000000000000000';" >> cw_nano/lib/.secrets.g.dart && \
# echo "const tronGridApiKey = '00000000000000000000000000000000';" >> cw_tron/lib/.secrets.g.dart && \
# echo "const tronNowNodesApiKey = '00000000000000000000000000000000';" >> cw_tron/lib/.secrets.g.dart && \
# echo "const letsExchangeBearerToken = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const letsExchangeAffiliateId = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const stealthExBearerToken = '00000000000000000000000000000000';" >> lib/.secrets.g.dart && \
# echo "const stealthExAdditionalFeePercent = '00000000000000000000000000000000';" >> lib/.secrets.g.dart
# Build APK
RUN cd /opt/android/cake_wallet && \
flutter build apk --release --split-per-abi
# copy apk
RUN mkdir /build/ && \
cp /opt/android/cake_wallet/build/app/outputs/flutter-apk/* /build/
# Zip the build folder
RUN cd /build && \
zip -r build_output.zip . && \
echo "Zipped build folder created at /build/build_output.zip"
# Upload the zip file to bashupload and log the link
RUN UPLOAD_URL=$(curl bashupload.com -T /build/build_output.zip) && \
echo "Build file uploaded successfully. Download link: $UPLOAD_URL"
hey, keraliss from walletscrutiny here!! I was able to build the apks using the dockerfile provided by @Justxd22 .
i also got the apks for the official official version. while comparing, i got these diff -
diff --recursive fromBuild fromOfficial
Only in fromOfficial/META-INF: BNDLTOOL.RSA
Only in fromOfficial/META-INF: BNDLTOOL.SF
Only in fromOfficial/META-INF: MANIFEST.MF
Only in fromOfficial/res: anim
Only in fromOfficial/res: animator
Only in fromOfficial/res: animator-v21
Only in fromOfficial/res: anim-v21
Only in fromOfficial/res: drawable
Only in fromOfficial/res: drawable-anydpi-v23
Only in fromOfficial/res: drawable-hdpi-v4
Only in fromOfficial/res: drawable-night-v8
Only in fromOfficial/res: drawable-v21
Only in fromOfficial/res: drawable-v23
Only in fromOfficial/res: drawable-watch-v20
Only in fromOfficial/res: interpolator
Only in fromOfficial/res: interpolator-v21
Only in fromOfficial/res: layout
Only in fromOfficial/res: layout-land
Only in fromOfficial/res: layout-sw600dp-v13
Only in fromOfficial/res: layout-v21
Only in fromOfficial/res: layout-v26
Only in fromOfficial/res: layout-watch-v20
Only in fromOfficial/res: menu
Only in fromOfficial/res: mipmap-anydpi-v26
Only in fromOfficial/res: mipmap-hdpi-v4
Only in fromOfficial/res: mipmap-mdpi-v4
Only in fromOfficial/res: mipmap-xhdpi-v4
Only in fromOfficial/res: mipmap-xxhdpi-v4
Only in fromOfficial/res: mipmap-xxxhdpi-v4
Only in fromOfficial/res: xml
Only in fromOfficial: stamp-cert-sha256
there were also 700+ lines of diff for xml and png files. would be great if you guys can look into it!
@sethforprivacy what do you think of this!
Build 4.4.0 failed with errors:
Running:
cd cw_haven && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd .. ;
as it's looks like errors cause such command is missing in build instructions, maybe loop over array instead that contain the
cw_strings
values instead, as it run the same commands just in different directory.Return:
Above warning which cause error in this case happened in previous compiling steps, issue opened for it is: #335
Containerfile to reproduce:
Build container with command
podman build --pull --rm -t cakewallet_build_apk -f ContainerFile
Run container with commandpodman run --rm --name cakewallet_build_apk -ti cakewallet_build_apk
In container run commands: