Skip to content

[Bug] Crash (SIGSEGV / abort) on Android emulator with 16KB page size when initializing Firebase (Unity, Firebase SDK 13.2.0) #1333

@pradeepvishwakarma-creator

Description

Description

App crashes with "signal 11 (SIGSEGV), code 2 (SEGV_ACCERR)" during firebase initialization. I followed official android documentation to verify that my apk is aligned with 16KB page size. Every time the crash starts when "Firebase Cloud messaging API initialized" message appears. Also the apk works on 4KB page size system image with Both Android 15 and 16. I created an empty project and only imported firebase sdk and the crash still happens.

What I already tried

  • Ran Powershell alignment check: all .so files are aligned.
  • Tested with APK.
  • Confirmed emulator page size is 16KB.
  • Cannot change NDK (Unity does not permits).
  • I tried preventing auto-init of firebase messaging and comment out only firebase messaging related code. It did NOT CRASHED, But if try to use FirebaseMessaging it CRASHES.

I tried following emulator specifications with 16KB page size and their results,

  • Android 16 - 16KB Google Play system image - WORKS
  • Android 16 - 16KB Google API system image - WORKS
  • Android 15 - 16KB Google Play system image - CRASHES
  • Android 15 - 16KB Google API system image- WORKS

Unity related extra details,

  • Gradle 8.11
  • Android SDK build tools 34.0.0
  • Android NDK 27.2.12479018

Android Studio related details,

  • Android Studio Narwhal 3 Feature Drop | 2025.1.3
  • Android SDK build tools 36.1.0
  • Android NDK 29.0.14033849
  • Android Emulator 36.1.9

Expected Result
Firebase should initialize Analytics and Cloud Messaging without crashing regardless of emulator page-size.

Actual Result
App Crashes on firebase initialization.

Following are the only two scripts that I have used in this project.
FirebaseManager

using Firebase;
using Firebase.Analytics;
using Firebase.Extensions;
using UnityEngine;

public class FirebaseManager : MonoBehaviour
{
    public static FirebaseManager Instance = null;
    public NotificationManager notificationManager;
    private DependencyStatus dependencyStatus = DependencyStatus.UnavailableOther;

    private void Start()
    {
        Log("FirebaseApp CheckAndFixDependenciesAsync");
        FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task =>
        {
            dependencyStatus = task.Result;
            Log($"DependencyStatus: {dependencyStatus}");
            if (dependencyStatus == DependencyStatus.Available)
            {
                Log("Initializing Firebase.");
                InitializeFirebase();
            }
            else
            {
                Log("Could not resolve all Firebase dependencies: " + dependencyStatus);
            }
        });
    }

    void InitializeFirebase()
    {
        Log("Enabling data collection.");
        FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);

        notificationManager.InitializeFirebase();
    }

    private void Log(object s) => Debug.Log($"[FirebaseManager] {s}");
}

NotificationManager

using UnityEngine;
using System;
using System.Threading.Tasks;
using Firebase.Messaging;
using System.Collections;

public class NotificationManager : MonoBehaviour
{
    public void InitializeFirebase()
    {
        Firebase.Messaging.FirebaseMessaging.MessageReceived += OnFirebaseMessageRecieve;
        Firebase.Messaging.FirebaseMessaging.TokenReceived += OnFirebaseUserTokenRecieved;

        GetTokenAsync();
    }

    private async void GetTokenAsync()
    {
        Log("Fetching Firebase Token");

        var task = FirebaseMessaging.GetTokenAsync();
        await Task.WhenAny(task, Task.Delay(TimeSpan.FromSeconds(5)));

        Log("Fetching Firebase Token Completed");

        if (task.IsCompleted)
        {
            Log($"Device Token : {task.Result}");
        }
        else
        {
            Log("EMPTY TOKEN");
        }
    }

    void OnFirebaseUserTokenRecieved(object sender, TokenReceivedEventArgs args)
    {
        Log($"OnFirebaseUserTokenRecieved token: {args.Token}");
    }

    void OnFirebaseMessageRecieve(object sender, MessageReceivedEventArgs args)
    {
        Log("OnFirebaseMessageRecieve");
        foreach (var item in args.Message.Data)
        {
            Log(item.Key + " - " + item.Value);
        }
    }

    private void Log(object s) => Debug.Log($"[NotificationManager] {s}");
}

Here are the attached logs.
firebase_crash_logcat_full.txt
firebase_crash_tombstone_29.txt

Reproducing the issue

This issue is 100% reproducible. Here are the steps to reproduce,

  • Create an Empty project with Unity 6 (6000.0.57f1) with IL2CPP backend.
  • Import Firebase unity sdk (AppCheck, Analytics and Messaging) version 13.2.0.
  • Resolve with external dependency manager.
  • Add provided FirebaseManager and NotificationManager scripts to game objects.
  • Build and play on Emulator with Android 15 and 16KB Google Play System Image.
  • App crashes.

Firebase Unity SDK Version

13.2.0

Unity editor version

6000.0.57f1

Installation Method

.unitypackage

Problematic Firebase Component(s)

Messaging

Other Firebase Component(s) in use

App Check, Analytics

Additional SDKs you are using

No response

Targeted Platform(s)

Android

Unity editor platform

Windows

Scripting Runtime

IL2CPP

Release Distribution Type

Pre-built SDK from https://firebase.google.com/download/unity

Relevant Log Output

2025/09/22 12:34:17.969 25705 25807 Info firebase Firebase Analytics API Initializing
2025/09/22 12:34:17.970 25705 25807 Info firebase analytics API Initialized
2025/09/22 12:34:17.973 25705 25807 Info firebase Firebase Cloud Messaging API Initialized
2025/09/22 12:34:18.018 25705 25705 Error CRASH *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2025/09/22 12:34:18.019 25705 25705 Error CRASH Version '6000.0.57f1 (b7b9860b7bbd)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'arm64-v8a', Stripping 'Disabled'
2025/09/22 12:34:18.019 25705 25705 Error CRASH Build fingerprint: 'google/sdk_gphone16k_x86_64/emu64xa16k:15/AE3A.240806.041/12890756:user/dev-keys'
2025/09/22 12:34:18.019 25705 25705 Error CRASH Revision: '0'
2025/09/22 12:34:18.019 25705 25705 Error CRASH ABI: 'arm64'
2025/09/22 12:34:18.020 25705 25745 Info Unity Firebase Analytics API Initializing
2025/09/22 12:34:18.020 25705 25745 Info Unity UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
2025/09/22 12:34:18.020 25705 25745 Info Unity Firebase.AppUtilPINVOKE:PollCallbacks()
2025/09/22 12:34:18.020 25705 25745 Info Unity Firebase.AppUtil:PollCallbacks()
2025/09/22 12:34:18.020 25705 25745 Info Unity Firebase.Platform.FirebaseHandler:Update()
2025/09/22 12:34:18.020 25705 25745 Info Unity 
2025/09/22 12:34:18.022 25705 25705 Error CRASH Timestamp: 2025-09-22 12:34:18.019315200+0530
2025/09/22 12:34:18.022 25705 25705 Error CRASH pid: 25705, tid: 25705, name: nd.test16kbmode  >>> com.testcompany.test16kbmode <<<
2025/09/22 12:34:18.022 25705 25705 Error CRASH uid: 10205
2025/09/22 12:34:18.022 25705 25745 Info Unity analytics API Initialized
2025/09/22 12:34:18.022 25705 25745 Info Unity UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
2025/09/22 12:34:18.022 25705 25745 Info Unity Firebase.AppUtilPINVOKE:PollCallbacks()
2025/09/22 12:34:18.022 25705 25745 Info Unity Firebase.AppUtil:PollCallbacks()
2025/09/22 12:34:18.022 25705 25745 Info Unity Firebase.Platform.FirebaseHandler:Update()
2025/09/22 12:34:18.022 25705 25745 Info Unity 
2025/09/22 12:34:18.022 25705 25705 Error CRASH signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr --------
2025/09/22 12:34:18.022 25705 25705 Error CRASH     x0  0000000000000000  x1  0000723e67afa2c0  x2  0000000000000009  x3  0000723e662c37fd
2025/09/22 12:34:18.022 25705 25705 Error CRASH     x4  000000000000001c  x5  0000723e6ef1bfb8  x6  0000000000000010  x7  7f7f7f7f7f7f7f7f
2025/09/22 12:34:18.022 25705 25705 Error CRASH     x8  0000723e40192a10  x9  0000000000000140  x10 000000000000001f  x11 0000000000000000
2025/09/22 12:34:18.022 25705 25705 Error CRASH     x12 0000000000000001  x13 000072408a40ca80  x14 0000000000000400  x15 0000000000000000
2025/09/22 12:34:18.022 25705 25705 Error CRASH     x16 0000723e401926b0  x17 0000000000000000  x18 0000723e6d71c000  x19 0000000000000000
2025/09/22 12:34:18.022 25705 25745 Info Unity Firebase Cloud Messaging API Initialized
2025/09/22 12:34:18.022 25705 25745 Info Unity UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
2025/09/22 12:34:18.022 25705 25745 Info Unity Firebase.AppUtilPINVOKE:PollCallbacks()
2025/09/22 12:34:18.022 25705 25745 Info Unity Firebase.AppUtil:PollCallbacks()
2025/09/22 12:34:18.022 25705 25745 Info Unity Firebase.Platform.FirebaseHandler:Update()
2025/09/22 12:34:18.022 25705 25745 Info Unity 
2025/09/22 12:34:18.022 25705 25705 Error CRASH     x20 0000000000000000  x21 0000000000000000  x22 0000000000000000  x23 0000000000000000
2025/09/22 12:34:18.022 25705 25705 Error CRASH     x24 0000000000000000  x25 0000000000000000  x26 0000000000000000  x27 0000000000000000
2025/09/22 12:34:18.022 25705 25705 Error CRASH     x28 0000000000000000  x29 0000000000000000
2025/09/22 12:34:18.023 25705 25705 Error CRASH     lr  0000000000000000  sp  0000723e6ef1bff0  pc  0000000000000000  pst 0000000000000000
2025/09/22 12:34:18.567 25705 25705 Error CRASH Forwarding signal 11
0001/01/01 00:00:00.000 -1 -1 Info  --------- beginning of crash
2025/09/22 12:34:18.567 25705 25705 Fatal libc Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x723d8398c1c8 in tid 25705 (nd.test16kbmode), pid 25705 (nd.test16kbmode)

If using CocoaPods for Apple platforms, the project's Podfile.lock

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: messagingneeds-infoNeed information for the developerstaleDon't have recent activity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions