Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce APK size, add debug symbols to AAB #2790

Merged
merged 1 commit into from
Sep 21, 2023
Merged

Conversation

PeterPetrik
Copy link
Contributor

@PeterPetrik PeterPetrik commented Sep 13, 2023

Problem1: we do not have native debug symbols in AAB ; fix #2147
Problem2: current APKs are now ~500MB, with old build it was ~90MB

Explanation of the existing situation:

New vckpg based android SDK is not compiled with -g as before (compare https://github.com/MerginMaps/input-sdk/blob/378d1bf861c940fb995ecdfaef9d22b0f4663992/vcpkg-overlay/triplets/arm64-android.cmake#L9 and https://github.com/MerginMaps/input-sdk/blob/472f8daee008f33a9d08c8c0f51904b114f2306d/android/distribute.sh#L361)

As NDK's cmake toolchain adds it by default (see android/ndk#243) we need to either compile with -g0 as before for release, or RATHER stripDebugDebugSymbols from gradle. This would allow us to have debug symbols too, so it is preferred option

unfortunately we are experiencing the bug similar to this facebook/react-native#32857

Fix

  • We removed -g0 from Input build - so now all build types has debug info (as is standard in Android Studio builds - it is stripped by Gradle)
  • We added to Gradle.build property android.ndkPath which is required to stripDebugSymbols task to work.
  • We changed the debug symbol type to SYMBOL_TABLE - size of debug symbol 68 MB (see https://developer.android.com/build/shrink-code), since with FULL the native debug symbols zip had 418 MB (above 300 MB limit) ; With this setting we should see all function names of ALL libraries (probably except Qt's, but definitely QGIS, GDAL, etc). We will NOT see line numbers and file-names. If we want to see that for QGIS/Input, we would need to compile input-sdk in a way that selected libraries (let say all but QGIS) will be compiled with -g0 and without all debug symbols altogether
  • currently I checked that APK (unzipped) does not have debug symbol in it, AAB has it included in bundle and all has expected sizes
68M build-input-android/app/android-build//build/outputs/native-debug-symbols/release/native-debug-symbols.zip 
118M build-input-android/app/android-build//build/outputs/apk/release/android-build-release-unsigned.apk
187M build-input-android/app/android-build//build/outputs/bundle/release/android-build-release.aab
  • in case we use sentry.io or other service in future for debug symbols (not uploading them to google play console) we may not be limited by size of the files

@PeterPetrik PeterPetrik changed the title WIP: make stripDebugDebugSymbols work Reduce APK size, add debug symbols to AAB Sep 14, 2023
@PeterPetrik PeterPetrik added the android 🤖 Relates to Android app version label Sep 14, 2023
add debug symbols to aab
@PeterPetrik PeterPetrik requested review from tomasMizera and removed request for wonder-sk September 14, 2023 11:44
@tomasMizera tomasMizera merged commit e18ba91 into master Sep 21, 2023
8 checks passed
@tomasMizera tomasMizera deleted the strip_android_apk branch September 21, 2023 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android 🤖 Relates to Android app version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Start uploading debug symbols from build to GPC for better native crash support
3 participants