Category Archives: Android

Building Vulkan samples for Android

Cloned the repository:

git clone https://github.com/SaschaWillems/Vulkan.git
git submodule init
git submodule update

Updated assets:

python.exe download_assets.py
(more…)

Touch target size on Android

Probably QT “Fusion” is not an appropriate style for Android apps, because its buttons height is not enough:

(more…)

Building QT6.4 on Windows for Android with OpenSSL and clang 14

Installed latest NDK:

(more…)

Building QT6.4 on Windows for Android with OpenSSL and clang 12

My mistake was that while building QT6.4 on Windows for Android I tried to set OPENSSL_ROOT_DIR as an environment variable that doesn’t take an effect. Now I set it as an argument:

C:\dev\build\qta
  
set "CMAKE_ROOT=C:\dev\PFiles\cmake-3.24.2-windows-x86_64\bin"
set "NINJA_ROOT=C:\dev\PFiles\ninja-win"
set "PERL_ROOT=C:\dev\PFiles\Strawberry\perl\bin"
set "MINGW_ROOT=C:\dev\PFiles\x86_64-12.2.0-release-win32-seh-rt_v10-rev0\mingw64\bin"
set "PYTHON_ROOT=C:\dev\PFiles\Python35"
set "JDK_ROOT=C:\dev\libs\jdk-19\bin"
          
set PATH=C:\WINDOWS\system32;C:\WINDOWS
set PATH=%CMAKE_ROOT%;%PATH%
set PATH=%NINJA_ROOT%;%PATH%
set PATH=%MINGW_ROOT%;%PATH%
set PATH=%PERL_ROOT%;%PATH%
set PATH=%PYTHON_ROOT%;%PATH%
set PATH=%JDK_ROOT%;%PATH%  

(more…)

My attempt to build OpenSSL for Android on Windows

I tried to build OpenSSL for Android with the following commands in Windows Command Prompt:

cd C:\dev\repos\openssl-1.1.1r

set MY_NDK_DIR=C:\Users\dmitr\AppData\Local\Android\Sdk\ndk\23.1.7779620

set MY_CLANG_DIR=%MY_NDK_DIR%\toolchains\llvm\prebuilt\windows-x86_64\bin
set MY_CMAKE=%MY_NDK_DIR%\prebuilt\windows-x86_64\bin\make.exe
set MY_PERL_DIR=C:\dev\PFiles\Strawberry\perl\bin

set PATH=%MY_CLANG_DIR%;%MY_PERL_DIR%;%PATH%

set "MY_ANDROID_BUILD_ABI=x86_64"
rem set "MY_ANDROID_BUILD_ABI=x86"
rem set "MY_ANDROID_BUILD_ABI=arm64"
rem set "MY_ANDROID_BUILD_ABI=arm"

set MY_INSTALL_ROOT_DIR=C:/dev/libs/OpenSSL-android
set MY_INSTALL_DIR=%MY_INSTALL_ROOT_DIR%/%MY_ANDROID_BUILD_ABI%

set ANDROID_NDK_HOME=%MY_NDK_DIR%

# Set compiler clang, instead of gcc by default
set CC=clang

perl Configure android-%MY_ANDROID_BUILD_ABI% -D__ANDROID_API__=23 --prefix="%MY_INSTALL_DIR%" --openssldir="%MY_INSTALL_DIR%" no-shared
(more…)

Building QT6.4 on Windows for Android

I installed Android Studio and pressed two buttons in QT Creator:

(more…)

Building QT 6.3.0 for Android on Windows with C++20

An example of how it can be configured:

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\24.0.8215888"
set "ANDROID_BUILD_TOOLS_REVISION=31.0.0"
set "ANDROID_BUILD_ABI=x86_64"
rem set "ANDROID_BUILD_ABI=x86"
rem set "ANDROID_BUILD_ABI=arm64-v8a"
rem set "ANDROID_BUILD_ABI=armeabi-v7a"

set MY_INSTALL_PATH=E:/Qt/Qt6.3.0/android.%ANDROID_BUILD_ABI%
set QT_HOST_PATH=E:/Qt/Qt6.3.0/windows
      
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 %ANDROID_BUILD_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 qtwebchannel -skip qtwebengine -skip qtwebview
(more…)

Dramatically annoying crash at std::thread and std::mutex destructors on Android

It is a long story that started here about 2 years ago. My first understanding was that it is a QT bug that was not fixed within this 2 years, of course (as a rule or usually), but a couple weeks ago I noticed that a similar crash happens on Samsung Galaxy devices:

#00  pc 000000000005fcb2  /apex/com.android.runtime/lib/bionic/libc.so (abort+166)
#00  pc 00000000000a9393  /apex/com.android.runtime/lib/bionic/libc.so (__fortify_fatal(char const*, ...)+26)
#00  pc 00000000000a8b9d  /apex/com.android.runtime/lib/bionic/libc.so (HandleUsingDestroyedMutex(pthread_mutex_t*, char const*)+20)
#00  pc 00000000000a8a89  /apex/com.android.runtime/lib/bionic/libc.so (pthread_mutex_lock+132)
#00  pc 00000000000a7879  /apex/com.android.runtime/lib/bionic/libc.so (pthread_cond_wait+40)
#00  pc 000000000004de2d  /system/lib/libc++.so (std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&)+8)
#00  pc 000000000038a7f1  /system/lib/libhwui.so (android::uirenderer::CommonPool::workerLoop()+60)
#00  pc 000000000038a73f  /system/lib/libhwui.so (void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, android::uirenderer::CommonPool::CommonPool()::$_0> >(void*)+94)
#00  pc 00000000000a8147  /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+20)
#00  pc 0000000000061467  /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30)
(more…)

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)
(more…)

An attempt to build static QT for Android

qtbase\cmake\QtPlatformAndroid.cmake contains this:

# Ensure we are using the shared version of libc++
if(NOT ANDROID_STL STREQUAL c++_shared)
    message(FATAL_ERROR "The Qt libraries on Android only supports the shared library configuration of stl. Please use -DANDROID_STL=\"c++_shared\" as configuration argument.")
endif()

and looks like -static-runtime works only for Windows.

I added -c++std c++20 -static -no-openssl to the configuration and removed -separate-debug-info:

(more…)