Skip to content

Crash on Android When Closing PDF Page After Scrolling || java.lang.IllegalStateException: Already closed #987

Open

Description

@jsq-cyber

We are encountering an app crash on Android devices when a user is viewing a PDF using react-native-pdf and closes the page after scrolling through it. The issue is consistently reported in Firebase with an IllegalStateException: Already closed error in the stack trace.

Steps to Reproduce:

Open a PDF with the react-native-pdf component.
Scroll or slide through multiple pages.
Close the PDF viewing page (e.g., by navigating away or closing the screen).
The app crashes.
Stack Trace (Firebase Report):

E FATAL EXCEPTION: PDF renderer
Process: com.app, PID: [varies]
java.lang.IllegalStateException: Already closed
at io.legere.pdfiumandroid.util.ConfigKt.handleAlreadyClosed(Config.kt:20)
at io.legere.pdfiumandroid.PdfPage.close(PdfPage.kt:582)
at kotlin.io.CloseableKt.closeFinally(Closeable.kt:56)
at io.legere.pdfiumandroid.PdfiumCore.renderPageBitmap(PdfiumCore.kt:406)
at com.github.barteksc.pdfviewer.PdfFile.renderPageBitmap(PdfFile.java:301)
at com.github.barteksc.pdfviewer.RenderingHandler.proceed(RenderingHandler.java:109)
at com.github.barteksc.pdfviewer.RenderingHandler.handleMessage(RenderingHandler.java:66)
at android.os.Handler.dispatchMessage(Handler.java:117)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:293)
at android.os.HandlerThread.run(HandlerThread.java:110)
Environment:

Platform: Android
Library: react-native-pdf
react-native-pdf version: 7.0.3
React Native Version: 0.79.2
Affected on multiple Android device models

Activity

  1. jean-at-pc commented on Nov 28, 2025

    @jean-at-pc

    dup of #976 , #959 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions