Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to invoke virtual method 'boolean android.os.HandlerThread.isAlive()' #237

Open
1 of 2 tasks
justinjoyn opened this issue Oct 6, 2022 · 10 comments
Open
1 of 2 tasks
Labels
bug Something isn't working

Comments

@justinjoyn
Copy link

Describe the bug
A clear and concise description of what the bug is.

On Android devices, the app crashes with following error:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.HandlerThread.isAlive()' on a null object reference
       at com.github.barteksc.pdfviewer.PDFView.loadComplete(PDFView.java:756)
       at com.github.barteksc.pdfviewer.DecodingAsyncTask.onPostExecute(DecodingAsyncTask.java:80)
       at com.github.barteksc.pdfviewer.DecodingAsyncTask.onPostExecute(DecodingAsyncTask.java:27)
       at android.os.AsyncTask.finish(AsyncTask.java:771)
       at android.os.AsyncTask.access$900(AsyncTask.java:199)
       at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:233)
       at android.os.Looper.loop(Looper.java:344)
       at android.app.ActivityThread.main(ActivityThread.java:8248)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:589)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1071)

To Reproduce

  • I checked the demo project and cannot reproduce the issue
  • I checked the demo project and the issue exists

Steps to reproduce the behavior:

  1. Open a screen with the PDFView component which has a resource set as a remote URL.
  2. Navigate away form the screen before the file loads.

Expected behavior
Handle onLoad even after navigating away from the screen with PDFView component

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: Motorola G60
  • OS: Android
  • Android Version 12

Additional context
Here are the related dependencies and their versions on our app.

        "@react-navigation/bottom-tabs": "6.3.3",
        "@react-navigation/native": "6.0.12",
        "@react-navigation/native-stack": "6.8.0",
        "react": "17.0.2",
        "react-native": "0.67.4",
        "react-native-view-pdf": "0.14.0",
@rumax
Copy link
Owner

rumax commented Oct 7, 2022

Hi @justinjoyn , when does this issue exactly happens, is app/screen active at this moment or it is some background or other screen state? Is it also some specific pdf (if so can you share it) or any?

I see barteksc/AndroidPdfViewer has open issue which might be similar to what you reported.

@justinjoyn
Copy link
Author

@rumax Thank you for looking into this.
This is happening when we unmount the screen while PDFView is still loading the file. It might not be file specific because I tried with different files (mostly larger files since they take time to load).

@rumax rumax added the bug Something isn't working label Oct 12, 2022
@justinjoyn
Copy link
Author

Hey @rumax were you able to reproduce this at your end?
Please share if you have any updates.

@stale
Copy link

stale bot commented May 15, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label May 15, 2023
@FaggioniHQ
Copy link

Hello there,

Any news on this? Any workaround???

Thanks in advance

@stale stale bot removed the wontfix This will not be worked on label Jun 12, 2023
@rumax
Copy link
Owner

rumax commented Jun 13, 2023

@FaggioniHQ as you can find from discussion above, it seems to be an issue in barteksc/AndroidPdfViewer. As a workaround, you can try to identify the specific circumstances in your project that trigger the issue and attempt to avoid them. Alternatively, if you're inclined to contribute, you have the option to submit a pull request to address and fix the problem in the library.

@FaggioniHQ
Copy link

hello @rumax ,

Thanks for your reply... I fixed the issue by using the latest version of https://github.com/mhiew/AndroidPdfViewer

On the latest version, the issue was fixed

buildscript {
 ext {
   ...
   pdfViewerVersion = "3.2.0-beta.3"
   pdfViewerRepo = "com.github.mhiew"
 }
 ...
}

@rumax
Copy link
Owner

rumax commented Jun 13, 2023

Maybe com.github.mhiew has to be default dependency. It also solves JCenter issue.

@tejasjoshiagile
Copy link

hello @rumax ,

Thanks for your reply... I fixed the issue by using the latest version of https://github.com/mhiew/AndroidPdfViewer

On the latest version, the issue was fixed

buildscript {
 ext {
   ...
   pdfViewerVersion = "3.2.0-beta.3"
   pdfViewerRepo = "com.github.mhiew"
 }
 ...
}

100% working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants