Qt Android: Why is a QtApp-debug.apk created for a Release build?

It may be an old question, but I have witnessed the same problem with Qt 5.12.3, a Release build produced debug APK in Release directory.

This happened because I didn't check on 'Signed' checkbox (and if you check it, you will be asked for password) when starting QtCreator. After providing password I got the usual android-build-release-signed.apk file.


This seems to be a bug on the build process of Qt Creator. The C++ files are compiled as they should, according to the selected build configuration (with optimizations and no debug info on release mode). So no matter your APK is named QtApp-debug.apk, the binaries inside are compiled as you choose.

The problem comes when calling androiddeployqt. If you look at the source, it creates a release package if it receives --release or also when it receives --sign. Qt Creator never passes the --release, so it compiles files as it should, but androiddeployqt only generates a release APK when you use a certificate, because Qt Creator passes the --sign

What are the differences of androiddeployqt creating a debug package:

  • The package name
  • It includes a gdbserver binary (aprox 250 KB on arm-v7)
  • It call ant with 'debug' instead of 'release'. This is what makes your apk signed with a debug key

Not having a certificate is not turning off optimizations and adding debug info, it's just creating a debug package, with debug signature which is necessary if you don't add your own. So after all, maybe it's not a bug.

Tags:

C++

Android

Qt

Apk