wonday / react-native-pdf

A <Pdf /> component for react-native
MIT License
1.6k stars 553 forks source link

[Android] Crash after update from 5.1.3 to 5.1.5 #396

Open mlecoq opened 5 years ago

mlecoq commented 5 years ago

What react-native version are you using? 0.59 (Expokit 35.0.0)

What react-native-pdf version are you using? 5.1.5 (works fine with 5.1.3)

What platform does your issue occur on? (android/ios/both) Android

Describe your issue as precisely as possible : 1) Steps to reproduce the issue or to explain in which case you get the issue

I am using react navigation, I have one view which displays the pdf (uri is passed with navigation params)

` const PDFScreen = ({ navigation }) => { const source = { uri: navigation.getParam('uri'), cache: true }; return (

);

}; `

when I go back from this page, the application crashes (on android simulator and device)

2) Interesting logs

2019-10-02 16:18:31.646 5581-5581/com.archireport.arlive E/AndroidRuntime: FATAL EXCEPTION: main Process: com.archireport.arlive, PID: 5581 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:695) at android.os.AsyncTask.access$600(AsyncTask.java:180) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193)

ridvanaltun commented 5 years ago
FATAL EXCEPTION: main
Process: com.salescomplete.mobile, PID: 9976
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:695)
at android.os.AsyncTask.-wrap1(Unknown Source:0)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7000)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

I get same error while same reason. When i return to screen this error occour.

react-native: 0.61.1 react-native-pdf: 5.1.5 rn-fetch-blob: 0.11.2

gomdolkim commented 5 years ago

same as me. and whenever changing tab in react navigation, it causes the crash.

ridvanaltun commented 5 years ago

I tested v5.1.4, it works fine.

wonday commented 5 years ago

It seems a problem of AndroidPdfViewer lib. https://github.com/barteksc/AndroidPdfViewer/issues/822

kesha-antonov commented 5 years ago

Same here

mohammadalijf commented 5 years ago

any workaround for this one?

wonday commented 5 years ago

Pls use v5.1.4

kesha-antonov commented 4 years ago

Is this solved in 6.0.0?

rohit75 commented 4 years ago

Same Issue here for following version react-native: 0.59.10 react-native-pdf: 5.1.4 rn-fetch-blob: 0.11.2

Any Solution?

YOEL311 commented 2 years ago

Any Solution?

pankaj610 commented 1 week ago

FIX: Upgrade to android-pdf-viewer version in build.gradle to 3.2.0-beta.2 implementation "com.github.mhiew:android-pdf-viewer:3.2.0-beta.2" Reference: https://github.com/mhiew/AndroidPdfViewer?tab=readme-ov-file