2

Title

Android 14/15 crash with Kivy + Buildozer: pthread_mutex_lock called on a destroyed mutex (SDLActivity)


Problem Description

I'm building a Python game using Kivy, packaged for Android via Buildozer and python-for-android. The app installs successfully, but crashes immediately on launch on Android 14 and 15 devices.

The crash log shows:

FORTIFY: pthread_mutex_lock called on a destroyed mutex (0x7eca402dc8)  
Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid (hwuiTask1), pid (SDLActivity)

There’s no Python traceback—the crash appears to be native-level, possibly inside SDL2 or HWUI threads.


Environment

  • OS: Ubuntu 24.04.3 LTS (x86_64)
  • Python: 3.9.9
  • Kivy: 2.3.0
  • Buildozer: 1.5.0
  • python-for-android: 2024.1.21 (latest GitHub)
  • NDK: r25c
  • Target API: 35
  • Arch: arm64-v8a (also tested armeabi-v7a)
  • Devices: Android 15 (also reproduced on Android 14)

What I Tried

  • Forcing GLES2 backend
  • Disabling multisamples
  • Building only for arm64-v8a
  • Updating python-for-android to latest GitHub version
  • Clean rebuild with buildozer android clean

Buildozer.spec Highlights

requirements = python3==3.9.9,kivy==2.3.0,cython==0.29.33,ffpyplayer,jnius,sdl2==2.28.5,sdl2_ttf,sdl2_image,sdl2_mixer
android.api = 35
android.minapi = 23
android.ndk = 25c
android.ndk_api = 23
android.enable_androidx = True
android.permissions = INTERNET
android.archs = arm64-v8a
android.meta_data = android.opengl.eglVersion=0x00020000

main.py Startup Code

import os, sys
from kivy.config import Config

os.environ["KIVY_METRICS_DENSITY"] = "2"
os.environ["KIVY_GL_BACKEND"] = "gles2"

Config.set("graphics", "multisamples", "0")
Config.set("graphics", "gles_backend", "gles2")
Config.set("graphics", "resizable", True)

# ... rest of imports and app logic ...

Expected Behavior

App should launch and display the game screen. I’m targeting API 35 for Play Store compatibility.


Question

Has anyone encountered this pthread_mutex_lock crash on Android 14/15 with SDL2 or Kivy?
Could this be related to NDK threading, SDL2 version, or Android’s HWUI changes?

Any workaround or insight would be greatly appreciated!


Let me know if you'd like help posting this or want to add a minimal reproducible example. You’re nearly there—this version should get attention from the right devs.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.