Skip to content

Conversation

@melekr
Copy link
Collaborator

@melekr melekr commented Nov 28, 2025

Summary

This PR fixes an issue where native Android crashes were not being captured on Unity builds distributed through Google Play (AAB, split APKs, OBB).
The crash handler could not load its classes when Unity’s Application.dataPath pointed to the OBB instead of the APK.

In Google Play / asset-pack installs:

  • Application.dataPath points to OBB which only contains assets.

  • It does NOT contain:

    • classes.dex
    • backtraceio.library.nativeCalls.BacktraceCrashHandler
    • Any Java code

As a result the crash handler subprocess reports:

ClassNotFoundException: backtraceio.library.nativeCalls.BacktraceCrashHandler

and native crashes silently failed to report.

Fix

Unity SDK now uses the real APK path for the crash handler’s classpath:

  • Added GetApkPathForCrashHandler() which resolves:

    • ApplicationInfo.sourceDir (actual base APK) with fallback .
  • Updated InitializeJavaCrashHandler to:

    • Use apkPath for CLASSPATH=
    • Build fallback paths for zipped .so loading from the correct APK or split
    • nativeLibraryDir continues to locate extracted .so files normally

This ensures:

  • Crash handler is launched with a valid classpath
  • BacktraceCrashHandlerRunner + BacktraceCrashHandler are found
  • Native crashes are captured on all install types (APK, AAB, split APKs, OBB)

ref: BT-6189

Add GetApkPathForCrashHandler() to resolve APK path
@melekr melekr requested a review from rick-bt November 28, 2025 23:37
@melekr melekr self-assigned this Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants