-
Describe the issueI am building QField v3.2.0 apk with docker. The build is succesful but the apk file size seems to be huge ( ~ 600Mo) comparing to released apk on store ( less than 100Mo) Reproduction stepsOS: Ubuntu 22.04 on wsl
Expected behaviorAPK file around 100Mo Observed behaviorAPK file around 600Mo Screenshots and GIFsMobile (please complete the following information)
Additional information
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
@qsavoye , size is caused by the build type is debug, which doesn't strip the libraries to ease debugging (the primary use of these local docker builds to begin with). |
Beta Was this translation helpful? Give feedback.
-
@nirvn thank for the reply, i also modified the cmake build type to release in build-vcpkg.sh. It does not change apk size. And on other version such as 3.1.9, the docker compute me an apk file around 80Mo even in debug. |
Beta Was this translation helpful? Give feedback.
-
@qsavoye , which .so have grown in size within the APK? The size differential definitively has to do with libs not being stripped. Did you try 3.1.9 or maybe an earlier build in the 3.1.x series? Prior to 3.1.5, we were not building the Qt libs themselves. That has changed in 3.1.5. |
Beta Was this translation helpful? Give feedback.
-
I made a test with the two last releases (3.1.9 and 3.2.0)
by reading the all .so file in /build-arm64-android/src/app/android-build/libs/arm64-v8a, i obtain the following table (size are on Mo)
As we can there is no extra growth variation except for libssl. So maybe libqfield_arm64-v8a.so is not stripped, maybe due to new qgis version (3.36)? I will continue my investigation on libqfield_arm64-v8a.so or on the bundle cmd to create the apk. I am not familiar with the last part, if you have any advice about it let me know. Kind Regards |
Beta Was this translation helpful? Give feedback.
-
I used the old docker file version (3.1.9) custom with open jdk 17 instead of 11 on qfield 3.2.0 it seems to solve the size issue. What is the main difference between the to files ? Android NDK/SDK version and installation ? |
Beta Was this translation helpful? Give feedback.
-
I finaly figure out what cause my apk size issue. I was due to the downloaded NDK files in the docker. I don't know why but if i install the NDK with the sdkmanager, the issue disapears. I put my corrected dockerfile FROM ubuntu:22.04
ENV ANDROID_NDK_VERSION=25.2.9519653
# Add apt packages
## vcpkg prerequisites
ENV APT_PACKAGES="git curl zip unzip tar"
## Common build prereqs
ENV APT_PACKAGES="$APT_PACKAGES g++ vim pkg-config cmake ninja-build ca-certificates"
ENV APT_PACKAGES="$APT_PACKAGES autoconf nasm bison python2 flex build-essential libtool libtool-bin gettext automake autoconf-archive"
## Python related
ENV APT_PACKAGES="$APT_PACKAGES python3-setuptools python3-pip python3-venv"
## freeglut
ENV APT_PACKAGES="$APT_PACKAGES libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxrandr-dev libxxf86vm-dev"
# glfw3
ENV APT_PACKAGES="$APT_PACKAGES libxinerama-dev libxcursor-dev"
# qtbase
ENV APT_PACKAGES="$APT_PACKAGES libxext-dev libxfixes-dev libxrender-dev \
libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libxcb-util0-dev \
libxkbcommon-dev libxcb-keysyms1-dev \
libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev \
libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev \
libxcb-render-util0-dev libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xinput-dev \
libxcb-cursor-dev libxkbcommon-x11-dev libcups2-dev"
## qtbase for android
ENV APT_PACKAGES="$APT_PACKAGES openjdk-17-jre-headless openjdk-17-jdk-headless"
RUN <<END_OF_SCRIPT bash
set -e
export DEBIAN_FRONTEND=noninteractive
# Apt prereqs itself
apt-get -y update
apt-get -y --no-install-recommends install ca-certificates
# Add apt repos
# Run apt things
apt-get -y update
apt-get -y dist-upgrade
apt-get -y --no-install-recommends install $APT_PACKAGES
curl -o /android-sdk-10406996.zip https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip
# curl -o /android-ndk-r25c-linux.zip https://dl.google.com/android/repository/android-ndk-r25c-linux.zip
# # Android NDK
# unzip /android-ndk-r25c-linux.zip
# rm -f android-ndk-r25c-linux.zip
# # Android SDK
unzip /android-sdk-10406996.zip -d android-sdk
rm -f android-sdk-10406996.zip
shopt -s extglob
mkdir /android-sdk/cmdline-tools/latest
mv /android-sdk/cmdline-tools/!(latest) /android-sdk/cmdline-tools/latest
yes | /android-sdk/cmdline-tools/latest/bin/sdkmanager --licenses
/android-sdk/cmdline-tools/latest/bin/sdkmanager "platforms;android-34" "build-tools;34.0.0" "platform-tools" "tools" "ndk;${ANDROID_NDK_VERSION}"
END_OF_SCRIPT
# ENV ANDROID_NDK_HOME /android-ndk-r25c
ENV ANDROID_SDK_ROOT /android-sdk
ENV ANDROID_NDK_HOME=${ANDROID_SDK_ROOT}/"ndk"/${ANDROID_NDK_VERSION}
WORKDIR /usr/src
|
Beta Was this translation helpful? Give feedback.
@nirvn
I finaly figure out what cause my apk size issue. I was due to the downloaded NDK files in the docker. I don't know why but if i install the NDK with the sdkmanager, the issue disapears.
I put my corrected dockerfile