Uploading debug symbols to Google Play Store

Did a quick google search and found this

I have the following components installed:

  • NDK (Side by side)
  • CMake
  • Android SDK Command-line Tools (latest)

Experimentation

Tried gradle version 7.0.3:

buildscript {
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.3'
    }
}

but got:

FAILURE: Build failed with an exception.

* Where:
Build file 'E:\repos\build\lgA\android-build\build.gradle' line: 17

* What went wrong:
A problem occurred evaluating root project 'android-build'.
> Failed to apply plugin 'com.android.internal.application'.
   > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
     You can try some of the following options:
       - changing the IDE settings.
       - changing the JAVA_HOME environment variable.
       - changing `org.gradle.java.home` in `gradle.properties`.

so I left 4.1.3 and tried to add both, see the docs

android.defaultConfig.ndk.debugSymbolLevel = 'FULL'

and

android.buildTypes.release.ndk.debugSymbolLevel = 'FULL'

to gradle.properties, but *.debug files were not added to aab file.

As an experiment tried not to separate debug information:

set "CMAKE_ROOT=E:\PFiles\cmake-3.21.3-windows-x86_64\bin"
set "NINJA_ROOT=E:\PFiles\ninja-win"
set "JDK_ROOT=C:\Program Files\Java\jdk1.8.0_301\bin"
set "MINGW_ROOT=E:\PFiles\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin"
set "PERL_ROOT=E:\PFiles\Strawberry\perl\bin"
      
set PATH=C:\WINDOWS\system32;C:\WINDOWS
set PATH=%CMAKE_ROOT%;%PATH%
set PATH=%NINJA_ROOT%;%PATH%
set PATH=%JDK_ROOT%;%PATH%
set PATH=%MINGW_ROOT%;%PATH%
set PATH=%PERL_ROOT%;%PATH%
set PATH=E:\PFiles\Python35;%PATH%
        
rem Check if the tools are in PATH
where gcc
where mingw32-make.exe
where perl.exe
where javac.exe
where python.exe
where cmake.exe
where ninja.exe
     
set "ANDROID_SDK_ROOT=C:\Users\D-Ef\AppData\Local\Android\Sdk"
set "ANDROID_NDK_PATH=C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk\22.1.7171670"
set "ANDROID_BUILD_TOOLS_REVISION=31.0.0"
      
set MY_ABI=x86_64
rem set MY_ABI=x86
rem set MY_ABI=arm64-v8a
rem set MY_ABI=armeabi-v7a
set MY_INSTALL_PATH=E:\Qt\Qt6.2.2\android
set QT_HOST_PATH=E:\Qt\Qt6.2.2\windows
set MY_INSTALL_PATH=%MY_INSTALL_PATH%.%MY_ABI%
     
configure.bat -platform win32-msvc -xplatform android-clang -prefix %MY_INSTALL_PATH% -qt-host-path %QT_HOST_PATH% ^
  -c++std c++20 -no-openssl -DQT_NO_EXCEPTIONS=1 -release -force-debug-info -opensource -confirm-license ^
  -android-sdk %ANDROID_SDK_ROOT% -android-ndk %ANDROID_NDK_PATH% -android-ndk-platform android-23 -android-abis %MY_ABI% ^
  -skip qt3d -skip qt5compat -skip qtactiveqt -skip qtcharts -skip qtcoap -skip qtconnectivity ^
  -skip qtdatavis3d -skip qtdoc -skip qtlottie -skip qtmqtt -skip qtnetworkauth -skip qtopcua ^
  -skip qtserialport -skip qtpositioning -skip qtquicktimeline -skip qtquick3d -skip qtremoteobjects ^
  -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtvirtualkeyboard -skip qtwayland -skip qtwebsockets ^
  -skip qtwebchannel -skip qtwebengine -skip qtwebview ^
  1> E:\temp\config-log18.txt 2>&1

but with both x86_x64 and arm64-v8a I got:

> Task :stripDebugDebugSymbols
Unable to strip the following libraries, packaging them as they are:
libMyAppQt_arm64-v8a.so, libQt6Core_arm64-v8a.so, libQt6Gui_arm64-v8a.so, libQt6Network_arm64-v8a.so,
libQt6OpenGL_arm64-v8a.so, libQt6QmlLocalStorage_arm64-v8a.so, libQt6QmlModels_arm64-v8a.so,
libQt6QmlWorkerScript_arm64-v8a.so, libQt6QmlXmlListModel_arm64-v8a.so, libQt6Qml_arm64-v8a.so,
libQt6QuickControls2Impl_arm64-v8a.so, libQt6QuickControls2_arm64-v8a.so, libQt6QuickDialogs2QuickImpl_arm64-v8a.so,
libQt6QuickDialogs2Utils_arm64-v8a.so, libQt6QuickDialogs2_arm64-v8a.so, libQt6QuickLayouts_arm64-v8a.so,
libQt6QuickParticles_arm64-v8a.so, libQt6QuickShapes_arm64-v8a.so, libQt6QuickTemplates2_arm64-v8a.so,
libQt6Quick_arm64-v8a.so, libQt6Sql_arm64-v8a.so, libQt6Svg_arm64-v8a.so, libQt6Widgets_arm64-v8a.so, libc++_shared.so,
libplugins_iconengines_qsvgicon_arm64-v8a.so, libplugins_imageformats_qgif_arm64-v8a.so,
libplugins_imageformats_qicns_arm64-v8a.so, libplugins_imageformats_qico_arm64-v8a.so,
libplugins_imageformats_qjpeg_arm64-v8a.so, libplugins_imageformats_qsvg_arm64-v8a.so,
libplugins_imageformats_qtga_arm64-v8a.so, libplugins_imageformats_qtiff_arm64-v8a.so,
libplugins_imageformats_qwbmp_arm64-v8a.so, libplugins_imageformats_qwebp_arm64-v8a.so,
libplugins_networkinformation_qandroidnetworkinformation_arm64-v8a.so, libplugins_platforms_qtforandroid_arm64-v8a.so,
libplugins_qmltooling_qmldbg_debugger_arm64-v8a.so, libplugins_qmltooling_qmldbg_inspector_arm64-v8a.so,
libplugins_qmltooling_qmldbg_local_arm64-v8a.so, libplugins_qmltooling_qmldbg_messages_arm64-v8a.so,
libplugins_qmltooling_qmldbg_native_arm64-v8a.so, libplugins_qmltooling_qmldbg_nativedebugger_arm64-v8a.so,
libplugins_qmltooling_qmldbg_preview_arm64-v8a.so, libplugins_qmltooling_qmldbg_profiler_arm64-v8a.so,
libplugins_qmltooling_qmldbg_quickprofiler_arm64-v8a.so, libplugins_qmltooling_qmldbg_server_arm64-v8a.so,
libplugins_qmltooling_qmldbg_tcp_arm64-v8a.so, libplugins_sqldrivers_qsqlite_arm64-v8a.so,
libplugins_styles_qandroidstyle_arm64-v8a.so, libplugins_tls_qcertonlybackend_arm64-v8a.so,
libqml_QtQml_Models_modelsplugin_arm64-v8a.so, libqml_QtQml_WorkerScript_workerscriptplugin_arm64-v8a.so,
libqml_QtQml_XmlListModel_qmlxmllistmodelplugin_arm64-v8a.so, libqml_QtQml_qmlplugin_arm64-v8a.so,
libqml_QtQuick_Controls_Basic_impl_qtquickcontrols2basicstyleimplplugin_arm64-v8a.so,
libqml_QtQuick_Controls_Basic_qtquickcontrols2basicstyleplugin_arm64-v8a.so,
libqml_QtQuick_Controls_Fusion_impl_qtquickcontrols2fusionstyleimplplugin_arm64-v8a.so,
libqml_QtQuick_Controls_Fusion_qtquickcontrols2fusionstyleplugin_arm64-v8a.so,
libqml_QtQuick_Controls_Imagine_impl_qtquickcontrols2imaginestyleimplplugin_arm64-v8a.so,
libqml_QtQuick_Controls_Imagine_qtquickcontrols2imaginestyleplugin_arm64-v8a.so,
libqml_QtQuick_Controls_Material_impl_qtquickcontrols2materialstyleimplplugin_arm64-v8a.so,
libqml_QtQuick_Controls_Material_qtquickcontrols2materialstyleplugin_arm64-v8a.so,
libqml_QtQuick_Controls_Universal_impl_qtquickcontrols2universalstyleimplplugin_arm64-v8a.so,
libqml_QtQuick_Controls_Universal_qtquickcontrols2universalstyleplugin_arm64-v8a.so,
libqml_QtQuick_Controls_impl_qtquickcontrols2implplugin_arm64-v8a.so,
libqml_QtQuick_Controls_qtquickcontrols2plugin_arm64-v8a.so, libqml_QtQuick_Dialogs_qtquickdialogsplugin_arm64-v8a.so,
libqml_QtQuick_Dialogs_quickimpl_qtquickdialogs2quickimplplugin_arm64-v8a.so,
libqml_QtQuick_Layouts_qquicklayoutsplugin_arm64-v8a.so,
libqml_QtQuick_LocalStorage_qmllocalstorageplugin_arm64-v8a.so,
libqml_QtQuick_NativeStyle_qtquickcontrols2nativestyleplugin_arm64-v8a.so,
libqml_QtQuick_Particles_particlesplugin_arm64-v8a.so, libqml_QtQuick_Shapes_qmlshapesplugin_arm64-v8a.so,
libqml_QtQuick_Templates_qtquicktemplates2plugin_arm64-v8a.so, libqml_QtQuick_Window_quickwindowplugin_arm64-v8a.so,
libqml_QtQuick_qtquick2plugin_arm64-v8a.so, libqml_QtQuick_tooling_quicktoolingplugin_arm64-v8a.so

and the same if I sign the package:

> Task :stripReleaseDebugSymbols
Unable to strip the following libraries, packaging them as they are:
...
> Task :extractReleaseNativeSymbolTables
Unable to extract native debug metadata from
E:\repos\examples\src\MyApp\build\intermediates\merged_native_libs\release\out\lib\x86_64\libc++_shared.so
because unable to locate the objcopy executable for the x86_64 ABI.

But there are a lot of objcopy.exe including the one in Android\Sdk\ndk\22.1.7171670\toolchains\llvm\prebuilt\windows-x86_64\x86_64-linux-android\bin

ar.exe
as.exe
ld.exe
ld.bfd.exe
ld.gold.exe
libwinpthread-1.dll
nm.exe
objcopy.exe
objdump.exe
ranlib.exe
readelf.exe
strip.exe

QT Creator generates the following android-LinesGameQt-deployment-settings.json

{
   "description": "This file is generated by qmake to be read by androiddeployqt and should not be modified by hand.",
   "qt": "E:/Qt/Qt6.2.2/android.x86_64",
   "sdk": "C:/Users/D-Ef/AppData/Local/Android/Sdk",
   "sdkBuildToolsRevision": "31.0.0",
   "ndk": "C:/Users/D-Ef/AppData/Local/Android/Sdk/ndk/22.1.7171670",
   "toolchain-prefix": "llvm",
   "tool-prefix": "llvm",
   "ndk-host": "windows-x86_64",
   "architectures": {"x86_64":"x86_64-linux-android"},
   "android-package-source-directory": "E:/repos/examples/src/LinesGame/LinesGameQt/platform/android",
   "android-min-sdk-version": "23",
   "android-target-sdk-version": "30",
   "qml-importscanner-binary": "E:/Qt/Qt6.2.2/windows/bin/qmlimportscanner",
   "rcc-binary": "E:/Qt/Qt6.2.2/windows/bin/rcc",
   "qml-root-path": "E:/repos/examples/src/LinesGame/LinesGameQt",
   "stdcpp-path": "C:/Users/D-Ef/AppData/Local/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib",
   "qrcFiles": "E:/repos/examples/src/LinesGame/build-LinesGameQt-Android_Qt_6_2_2_android_x86_64_Clang_x86_64-Release/qml_qmlcache.qrc,E:/repos/examples/src/LinesGame/LinesGameQt/scene.qrc,E:/repos/examples/src/LinesGame/LinesGameQt/icons.qrc,E:/repos/examples/src/LinesGame/build-LinesGameQt-Android_Qt_6_2_2_android_x86_64_Clang_x86_64-Release/qmake_qmake_immediate.qrc,E:/repos/examples/src/LinesGame/LinesGameQt/qml.qrc",
   "application-binary": "LinesGameQt"
}

Tried to build QT with Java 11:

NoteJDK 11 or earlier must be used to properly build Qt for Android.

set "CMAKE_ROOT=E:\PFiles\cmake-3.21.3-windows-x86_64\bin"
set "NINJA_ROOT=E:\PFiles\ninja-win"
set "JDK_ROOT=C:\Program Files\Java\jdk-11.0.11\bin"
set "MINGW_ROOT=E:\PFiles\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin"
set "PERL_ROOT=E:\PFiles\Strawberry\perl\bin"
      
set PATH=C:\WINDOWS\system32;C:\WINDOWS
set PATH=%CMAKE_ROOT%;%PATH%
set PATH=%NINJA_ROOT%;%PATH%
set PATH=%JDK_ROOT%;%PATH%
set PATH=%MINGW_ROOT%;%PATH%
set PATH=%PERL_ROOT%;%PATH%
set PATH=E:\PFiles\Python35;%PATH%
        
rem Check if the tools are in PATH
where gcc
where mingw32-make.exe
where perl.exe
where javac.exe
where python.exe
where cmake.exe
where ninja.exe
     
set "ANDROID_SDK_ROOT=C:\Users\D-Ef\AppData\Local\Android\Sdk"
set "ANDROID_NDK_PATH=C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk\22.1.7171670"
set "ANDROID_BUILD_TOOLS_REVISION=31.0.0"
      
rem set MY_ABI=x86_64
set MY_ABI=x86
rem set MY_ABI=arm64-v8a
rem set MY_ABI=armeabi-v7a
set MY_INSTALL_PATH=E:\Qt\Qt6.2.2\android
set QT_HOST_PATH=E:\Qt\Qt6.2.2\windows
set MY_INSTALL_PATH=%MY_INSTALL_PATH%.%MY_ABI%
echo QT will be installed to %MY_INSTALL_PATH%
     
configure.bat -platform win32-msvc -xplatform android-clang -prefix %MY_INSTALL_PATH% -qt-host-path %QT_HOST_PATH% ^
  -c++std c++20 -no-openssl -DQT_NO_EXCEPTIONS=1 -release -force-debug-info -opensource -confirm-license ^
  -android-sdk %ANDROID_SDK_ROOT% -android-ndk %ANDROID_NDK_PATH% -android-ndk-platform android-23 -android-abis %MY_ABI% ^
  -skip qt3d -skip qt5compat -skip qtactiveqt -skip qtcharts -skip qtcoap -skip qtconnectivity ^
  -skip qtdatavis3d -skip qtdoc -skip qtlottie -skip qtmqtt -skip qtnetworkauth -skip qtopcua ^
  -skip qtserialport -skip qtpositioning -skip qtquicktimeline -skip qtquick3d -skip qtremoteobjects ^
  -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtvirtualkeyboard -skip qtwayland -skip qtwebsockets ^
  -skip qtwebchannel -skip qtwebengine -skip qtwebview ^
  1> E:\temp\config-log20.txt 2>&1

and switched to Gradle 7.0.3, but it did not help.

When I upload my app I get a warning:

This APK contains native code, and you’ve not uploaded debug symbols. We recommend you upload a symbol file to make your crashes and ANRs easier to analyze and debug. Learn More

Finally I added

android {
    ...
    defaultConfig {
        resConfig "en"
        minSdkVersion qtMinSdkVersion
        targetSdkVersion qtTargetSdkVersion
        ndk.abiFilters = qtTargetAbiList.split(",")
        ndk.debugSymbolLevel "FULL"
    }
}

and Gradle started to generate android-build\build\outputs\native-debug-symbols\release\native-debug-symbols.zip file of 241 MB size.

Other warnings:

This APK results in unused code and resources being sent to users. Your app could be smaller if you used the Android App Bundle. By not optimizing your app for device configurations, your app is larger to download and install on users’ devices than it needs to be. Larger apps see lower install success rates and take up storage on users’ devices.

There is no deobfuscation file associated with this APK. If you use obfuscated code (R8/proguard), uploading a deobfuscation file will make crashes and ANRs easier to analyze and debug. Using R8/proguard can help reduce app size. Learn More

Leave a Reply

Your email address will not be published. Required fields are marked *