binSaed / flutter_cached_pdfview

Enhanced PDF view for Flutter.
https://pub.dev/packages/flutter_cached_pdfview
MIT License
121 stars 70 forks source link

Blank PDF on Android --release #59

Closed dgriff24 closed 3 years ago

dgriff24 commented 3 years ago

When running Flutter in --release mode, the pdf is blank page. This does not happen in iOS or in Android debug mode.

To Reproduce

PDF(swipeHorizontal: false).cachedFromUrl('https://firebasestorage.googleapis.com/v0/b/[...]')

Smartphone (please complete the following information):

Additional context Dart 2.11.0 flutter_cached_pdfview: ^0.3.5

dgriff24 commented 3 years ago

After a little more digging, I found that PDF.onError is called. It returns the following error:

java.lang.UnsatisfiedLinkError: No implementation found for long com.shockwave.pdfium.PdfiumCore.nativeOpenDocument(int, java.lang.String) (tried Java_com_shockwave_pdfium_PdfiumCore_nativeOpenDocument and Java_com_shockwave_pdfium_PdfiumCore_nativeOpenDocument__ILjava_lang_String_2)

I have also tried PDF([...]).fromUrl(...) which didn't fix the issue.

binSaed commented 3 years ago

to create android release u need to use proguard-rules.pro

https://github.com/AbdOoSaed/flutter_cached_pdfview/blob/272431eb0edadfcbb85f7a199285dd8e7a801e4d/example/android/app/build.gradle#L64

https://github.com/AbdOoSaed/flutter_cached_pdfview/blob/master/example/android/app/proguard-rules.pro

and don't forget to run flutter clean

dgriff24 commented 3 years ago

This was fixed by running flutter clean, but I added proguard anyway. Thanks!

nimisharanipabacancy commented 2 years ago

I am using plugin flutter_cached_pdfview 0.4.1 version. I have add same proguard rules as mention in above comment. Still I am facing blank pdf.

Use following version: Flutter 2.5.1 • channel stable • https://github.com/flutter/flutter.git Tools • Dart 2.14.2

binSaed commented 2 years ago

@nimisharanipabacancy Please try example app U can find it in this repo

pengMaster commented 2 years ago

flutter clean