AndroidPdfViewer
AndroidPdfViewer copied to clipboard
Cannot load pdf for some devices
I've problem for some devices cannot load pdf, but i can get pdf link from the API, and i've error like this:
E/PDFView: load pdf error java.io.FileNotFoundException: open failed: ENOENT (No such file or directory) at android.os.ParcelFileDescriptor.openInternal(ParcelFileDescriptor.java:313) at android.os.ParcelFileDescriptor.open(ParcelFileDescriptor.java:211) at com.github.barteksc.pdfviewer.source.FileSource.createDocument(FileSource.java:37) at com.github.barteksc.pdfviewer.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:53) at com.github.barteksc.pdfviewer.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:25) at android.os.AsyncTask$2.call(AsyncTask.java:333) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764)
same issue on Android 10 devices. does anyone fixed ?
I'm use file Loader to load pdf data from server , it's work for me
I found this can help this issue https://stackoverflow.com/questions/57116335/environment-getexternalstoragedirectory-deprecated-in-api-level-29-java You need replace Environment.getExternalStorageDirectory() to requireContext().externalCacheDir