scientifichackers / flutter_pdf_viewer

A native PDF viewer for flutter.
MIT License
107 stars 40 forks source link

not work when release with minifyEnabled in gradle. #30

Closed itsbohara closed 4 years ago

itsbohara commented 5 years ago

Logs

Hello devs, pdf viewer not works when minifyEnabled in grade. I have also try using your example and enabling minify, does not work in release. Why ??

alexZaicev commented 5 years ago

@iamb7 did you specified ProGuard rules to keep dependencies that are used by the plugin?

devxpy commented 4 years ago

I believe this is because this plugin does reflection, to dynamically dispatch method calls from dart - which breaks when identifiers are obfuscated by proguard.

The solution is to either not use minifyEnabled or write your own proguard rules to prevent this plugin and its dependencies from being obfuscated.

We have no plans of providing proguard rules as of now.

razein97 commented 4 years ago

Those that want to keep minify enabled along with shrink resources can use:

 -keep class com.shockwave.** { *; }
 -keep class com.pycampers.** { *; }

in their proguard-rules.pro

The shockwave class is used by the base library. The pycampers class is used by this plugin.