Category Archives: Android

Where Android permissions come from in a Qt application

While preparing a release of my Qt-based Lines game for RuStore, I was asked to explain why the app requested WRITE_EXTERNAL_STORAGE. The game saves its state in its own data directory, so this permission was unexpected. It was absent from my source manifest but present in the generated Android package.

I traced the permissions through Qt deployment and Gradle manifest merging. Here is what my build contains, where the declarations originate, and how to exclude an unnecessary permission without modifying Qt.

(more…)

My Android Phone requires release apps to be signed

When I try to install an unsigned release app

adb install android-build-release-unsigned.apk

I get

Performing Streamed Install
adb: failed to install android-build-release-unsigned.apk: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl827870317.tmp/base.apk: Attempt to get length of null array]
(more…)

“Null object reference” exceptions on Android 14 in a QT app

When I switched to QT 6.7.2 and set QT_ANDROID_TARGET_SDK_VERSION "34" (that is Android 14) my QT app started to crash with the following stack traces:

On google Pixel 5 64-bit only 1080x2340 Android 14 (SDK 34) arm64-v8a:

Exception java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
  at android.os.Parcel.createExceptionOrNull (Parcel.java:3189)
  at android.os.Parcel.createException (Parcel.java:3167)
  at android.os.Parcel.readException (Parcel.java:3150)
  at android.database.DatabaseUtils.readExceptionFromParcel (DatabaseUtils.java:202)
  at android.database.DatabaseUtils.readExceptionFromParcel (DatabaseUtils.java:154)
  at android.content.ContentProviderProxy.call (ContentProviderNative.java:764)
  at android.content.ContentResolver.call (ContentResolver.java:2466)
  at android.content.ContentResolver.call (ContentResolver.java:2446)
  at ekfr.a (:com.google.android.gms@242013038@24.20.13 (190400-633713831):29)
  at com.google.android.gms.wallet.intentoperation.setupwizard.PaymentsSetupWizardAccountChangeIntentOperation.onHandleIntent (:com.google.android.gms@242013038@24.20.13 (190400-633713831):252)
  at com.google.android.chimera.IntentOperation.onHandleIntent (:com.google.android.gms@242013038@24.20.13 (190400-633713831):2)
  at ajdw.onHandleIntent (:com.google.android.gms@242013038@24.20.13 (190400-633713831):8)
  at pbh.run (:com.google.android.gms@242013038@24.20.13 (190400-633713831):70)
  at pbg.run (:com.google.android.gms@242013038@24.20.13 (190400-633713831):152)
  at elbx.run (:com.google.android.gms@242013038@24.20.13 (190400-633713831):21)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:644)
  at java.lang.Thread.run (Thread.java:1012)
(more…)

Updating Yandex Mobile SDK to version 7.1

QT generates gradle.properties with the following values:

android.useAndroidX=true
android.enableJetifier=true
androidBuildToolsVersion=34.0.0
androidCompileSdkVersion=34
androidNdkVersion=26.2.11394342
buildDir=build
qt5AndroidDir=C:/dev/libs/Qt6/android/release/arm64-v8a/./src/android/java
qtAndroidDir=C:/dev/libs/Qt6/android/release/arm64-v8a/./src/android/java
qtMinSdkVersion=23
qtTargetAbiList=arm64-v8a
qtTargetSdkVersion=33
(more…)

My QT app started to crash on x86_64 Android Emulator

My QT app started to crash on x86_64 Android Emulator with the following stack trace:

03-16 20:56:48.848 15806 15806 I crash_dump64: performing dump of process 15639 (target tid = 15717)
03-16 20:56:48.875 15806 15806 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-16 20:56:48.875 15806 15806 F DEBUG   : Build fingerprint: 'google/sdk_gphone_x86_64/generic_x86_64_arm64:11/RSR1.201211.001/7027799:user/release-keys'
03-16 20:56:48.875 15806 15806 F DEBUG   : Revision: '0'
03-16 20:56:48.875 15806 15806 F DEBUG   : ABI: 'x86_64'
03-16 20:56:48.905 15806 15806 F DEBUG   : Timestamp: 2024-03-16 20:56:48+0300
03-16 20:56:48.905 15806 15806 F DEBUG   : pid: 15639, tid: 15717, name: qtMainLoopThrea  >>> com.domain.MyApp <<<
03-16 20:56:48.905 15806 15806 F DEBUG   : uid: 10154
03-16 20:56:48.906 15806 15806 F DEBUG   : signal 4 (SIGILL), code -6 (SI_TKILL), fault addr --------
03-16 20:56:48.906 15806 15806 F DEBUG   :     rax 0000000000000000  rbx 0000795eb6bbdfe8  rcx 00007964be7b4c87  rdx 0000000000000004
03-16 20:56:48.907 15806 15806 F DEBUG   :     r8  0000000000000001  r9  0000000000000001  r10 00007ffff4f830a8  r11 0000000000000202
03-16 20:56:48.907 15806 15806 F DEBUG   :     r12 0000796216b00050  r13 00007962254b6828  r14 0000000000000000  r15 0000000000000004
03-16 20:56:48.907 15806 15806 F DEBUG   :     rdi 0000000000003d17  rsi 0000000000003d65
03-16 20:56:48.907 15806 15806 F DEBUG   :     rbp 0000795eb6bbceb0  rsp 0000795eb6bbcc78  rip 00007964be7b4c87
03-16 20:56:48.932 15806 15806 F DEBUG   : backtrace:
03-16 20:56:48.932 15806 15806 F DEBUG   :       #00 pc 00000000000b1c87  /apex/com.android.runtime/lib64/bionic/libc.so (tgkill+7) (BuildId: 3707c39fc397eeaa328142d90b50a973)
03-16 20:56:48.932 15806 15806 F DEBUG   :       #01 pc 00000000000faa12  /system/lib64/libndk_translation.so (ndk_translation::Decoder<ndk_translation::SemanticsPlayer<ndk_translation::(anonymous namespace)::Interpreter> >::DecodeSimdScalarTwoRegMisc()+642) (BuildId: 86c2b523febcecc53af82646dc316948)
03-16 20:56:48.932 15806 15806 F DEBUG   :       #02 pc 00000000000f2846  /system/lib64/libndk_translation.so (ndk_translation::Decoder<ndk_translation::SemanticsPlayer<ndk_translation::(anonymous namespace)::Interpreter> >::DecodeDataProcessingSimdAndFp()+2374) (BuildId: 86c2b523febcecc53af82646dc316948)
03-16 20:56:48.932 15806 15806 F DEBUG   :       #03 pc 00000000000eee3a  /system/lib64/libndk_translation.so (ndk_translation::Decoder<ndk_translation::SemanticsPlayer<ndk_translation::(anonymous namespace)::Interpreter> >::Decode(unsigned int)+1114) (BuildId: 86c2b523febcecc53af82646dc316948)
03-16 20:56:48.932 15806 15806 F DEBUG   :       #04 pc 00000000000ee996  /system/lib64/libndk_translation.so (ndk_translation::InterpretInsn(ndk_translation::ProcessState*)+118) (BuildId: 86c2b523febcecc53af82646dc316948)
03-16 20:56:48.932 15806 15806 F DEBUG   :       #05 pc 0000000000123fbe  /system/lib64/libndk_translation.so (BuildId: 86c2b523febcecc53af82646dc316948)
(more…)

Building QT 6.6.2 for Windows and Android

I installed MS Visual Studio, Android Studio and the following tools:

cmake-3.24.2-windows-x86_64
nasm-2.15.05
ninja-win
Python35
Strawberry
VulkanSDK
x86_64-12.2.0-release-win32-seh-rt_v10-rev0

and built QT for Windows with the following commands:

(more…)

Sharing Android phone over TCP with ADB

I was able to share my Android phone over TCP with the following commands:

adb kill-server
start cmd /k adb -a -P 5037 nodaemon server start
(more…)

Building RenderDoc for Android on WSL

I cloned the repository, created build directory, set environment variables and run CMake:

git clone https://github.com/baldurk/renderdoc.git
cd renderdoc/
mkdir build-android
cd build-android
export JAVA_HOME=~/dev/repos/graphicsprofiler/tools/buildtools/jdk
export ANDROID_SDK=~/dev/repos/graphicsprofiler/tools/buildtools/android
export ANDROID_NDK=~/dev/repos/graphicsprofiler/tools/buildtools/android/ndk-bundle/android-ndk-r20b
export PATH=$PATH:$JAVA_HOME/bin
cmake -DBUILD_ANDROID=On -DANDROID_ABI=armeabi-v7a ..
(more…)

Black screen on starting QT Android app

I noticed this about five years ago and hoped that it had passed away, but a few days ago a user reported the following:

(more…)

Yandex Mobile Ads actively crashes on Android

There was an ANR in my Android app, but a few days later Yandex Mobile Ads started to actively crash messing up my statistics:

(more…)