惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
L
LangChain Blog
人人都是产品经理
人人都是产品经理
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tailwind CSS Blog
N
Netflix TechBlog - Medium
Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
博客园 - 【当耐特】
量子位
有赞技术团队
有赞技术团队
Jina AI
Jina AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
C
Check Point Blog
B
Blog RSS Feed
M
MIT News - Artificial intelligence
H
Help Net Security
雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 聂微东
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
A
About on SuperTechFans
腾讯CDC

Inside Nutrient

A guide to the invisible work behind documents Introducing Nutrient Documents for Salesforce: Native document generation and signing Document AI vs. traditional OCR: Choosing between OCR, AI, and hybrid pipelines PDF SDK compliance and security evaluation checklist for enterprise teams (2026) Invariant Corp replaces paper processes with Nutrient Workflow and scales without limits What is process mapping? A complete guide Nutrient vs. Conga Composer for Salesforce document generation (2026) Document routing: How to automate document distribution The CTO’s AI playbook: Why accountability architecture beats orchestration Compliance workflow automation: Why built-in compliance is table stakes Workflow diagrams: Examples, symbols, and how to build one that actually runs Digital forms: Replace paper forms with automated workflows Approval workflow software: How to automate approvals Why document-centric automation is different The CEO’s AI playbook: Why decision architecture beats model selection Nutrient SDK product updates for Q1 2026 PDF redaction verification: How to prove sensitive data is permanently removed What is a VPAT? The complete guide to accessibility conformance reports What is PDF/UA? The accessible PDF standard explained Salesforce eSignatures: Generate, sign, and track documents in one flow Online document viewer: Options, tradeoffs, and how to embed one Document viewer for web apps: React, Vue, Angular (2026) Best document viewers in 2026: A buyer’s guide How to edit a PDF in Python: Add text, images, and annotations Nutrient advances Workflow platform with agentic AI for enterprise-grade speed and consistency in document-heavy operations How to create a Salesforce quote template from opportunity data The business case for accessibility: Five ways it drives enterprise value Python PDF library comparison (2026): 7 libraries for developers Why your AI agent hallucinates PDF table data PDF.js limitations: When to upgrade to a commercial PDF SDK
Handling fatal errors in Android
Michael Kellner · 2025-07-23 · via Inside Nutrient

Table of contents

    Handling fatal errors in Android

    When working with Android, most exceptions can be anticipated and handled gracefully. But fatal errors — which are severe issues that cause an application or system to stop running — operate outside the usual exception handling flow and pose a different kind of challenge. This is especially relevant if your app integrates Nutrient Android SDK, which makes extensive use of RxJava.

    The RxJava limitation

    RxJava is a great fit for reactive operations, but one caveat is often overlooked: It doesn’t handle fatal errors.

    RxJava treats the following three classes as fatal:

    • VirtualMachineError
    • ThreadDeath
    • LinkageError

    These indicate severe problems in the Java virtual machine (JVM) that shouldn’t be caught or suppressed. Ideally, you’ll never encounter any of them — but the most common one in practice is OutOfMemoryError, which is a subclass of VirtualMachineError.

    If such a fatal error occurs:

    • onErrorResumeNext, onErrorReturn, and similar operators won’t catch it.
    • RxJavaPlugins.setErrorHandler() won’t be called.
    • The error escapes the Rx chain and will crash your app unless it’s caught by a global exception handler.

    Why our SDK can’t “catch” them for you

    We often get asked: Why can’t the SDK handle this internally? The answer comes down to two core reasons:

    1. Global handlers are shared state
      While we could install a Thread.setDefaultUncaughtExceptionHandler to catch these errors, doing so would overwrite any handler you or another dependency might have installed, in turn breaking crash reporting, logging, or custom recovery behavior.

    2. There’s no safe recovery path
      Catching an OutOfMemoryError inside SDK code doesn’t guarantee anything. At that point, the memory is already exhausted. Continuing execution would likely lead to undefined behavior, corrupted state, or additional crashes.

    As a well-behaved SDK, Nutrient Android SDK avoids interfering with your app’s global state, and it doesn’t pretend to offer graceful recovery from unrecoverable conditions.

    Best practices for SDK users

    Here’s what we recommend if you want to proactively handle these scenarios.

    1. Install a default uncaught exception handler

    This gives you a chance to log, report, or even restart the app:

    Thread.setDefaultUncaughtExceptionHandler { thread, throwable ->

    // Custom logic here — logging, reporting, analytics, etc.

    }

    Install this early in your Application.onCreate() to ensure it captures everything.

    2. Be mindful of memory

    Large PDFs and/or complex PDFs can be memory-intensive. Pay attention to:

    • onTrimMemory() and onLowMemory() callbacks — keep in mind that the latter isn’t being called if your targetSDK is >= 34.

    3. Don’t rely on SDK-level catching

    Fatal errors can’t be caught inside the SDK in any meaningful or reliable way. If you need custom error recovery or logging, it needs to be implemented at the application level.

    TL;DR

    RxJava doesn’t catch fatal errors, and neither can we — not in a safe, non-invasive way. If you’re using our SDK, we recommend:

    • Setting up a default uncaught exception handler
    • Monitoring memory usage
    • Handling recovery logic at the app level

    That’s the only robust way to observe and respond to fatal errors in production environments.

    Have questions or want help hardening your app’s integration? Reach out to our Sales and Support teams.

    Explore related topics

    Try for free Ready to get started?

    Related SDK articles

    Explore more