question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting crash on Android 11

See original GitHub issue

java.lang.IllegalArgumentException: fd cannot be null at Ua.onWrite(Unknown Source:187) at android.print.PdfConverter$1.onPageFinished(PdfConverter.java:71) at bC0.b(Unknown Source:10) at V9.handleMessage(Unknown Source:280) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:257) at android.app.ActivityThread.main(ActivityThread.java:8192) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:626) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1015)

2021-11-28 19:54:13.478 7756-7756/com.test.desk D/PdfConverter: Failed to open ParcelFileDescriptor java.io.FileNotFoundException: open failed: EACCES (Permission denied) at android.os.ParcelFileDescriptor.openInternal(ParcelFileDescriptor.java:344) at android.os.ParcelFileDescriptor.open(ParcelFileDescriptor.java:231) at android.print.PdfConverter.getOutputFileDescriptor(PdfConverter.java:154) at android.print.PdfConverter.access$100(PdfConverter.java:33) at android.print.PdfConverter$1.onPageFinished(PdfConverter.java:71) at bC0.b(Unknown Source:10) at V9.handleMessage(Unknown Source:280) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:257) at android.app.ActivityThread.main(ActivityThread.java:8192) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:626) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1015) 2021-11-28 19:54:13.479 7756-7756/com.test.desk W/om.test.des: Accessing hidden method Landroid/print/PrintDocumentAdapter$WriteResultCallback;-><init>()V (greylist, linking, allowed) 2021-11-28 19:54:13.486 7756-7756/com.test.desk D/AndroidRuntime: Shutting down VM

Getting crash whole generating pdf file.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

4reactions
manawaraquevixcommented, Feb 28, 2022

Go to android/src/main/java/com/christopherdro/htmltopdf/RNHTMLtoPDFModule.java line 68 and replace new File(Environment.getExternalStorageDirectory(), options.getString(DIRECTORY)) :

with new File(Build.VERSION.SDK_INT >= 30 ? mReactContext.getExternalFilesDir(null):Environment.getExternalStorageDirectory(), options.getString(DIRECTORY)) :

1reaction
rohitatcoffeecommented, Dec 3, 2021

Thanks for you’re response really appreciate you’re valuable time can you help me where can add this permission? Is there any specific file?

Thanks in advance

Please check, issue is fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

11 Quick Ways to Fix App Keeps Crashing on Android [2022]
11 Quick Ways to Fix Apps Keep Crashing on Android · Go to “Settings” > Apps > Find the app that keeps crashing....
Read more >
Are your Android apps crashing? You're not alone. (Update
Android apps are randomly crashing for some users. The issue seems to stem from a bad Android System WebView update. Google has issued...
Read more >
Android Apps Crashing? The Causes and Best Fixes
Wondering why your Android apps keep crashing? Wonder no more with our guide to common causes of Android app crashes that will work!...
Read more >
How to troubleshoot Crash in App Running Android 11 ...
3. Be aware that they may be possible System WebView issue: Android apps keep crashing: Gmail, Yahoo Mail, Google app issues reported -Android ......
Read more >
Why do my apps keep crashing on Android, How to fix it
There can be multiple reasons why apps to freeze or crash, especially when you consider the wide range of chipsets, screen resolutions, custom ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found