Closed wcewong closed 2 months ago
Hello, thanks for using my package.
I ported this package from AndroidPdfViewer, so you should look through native android library.
Hi. I should be thanking you instead for saving me hours of development time :-)
I've looked at AndroidPdfViewer - it appears to be based on the PDFium engine. I couldn't find anything useful on their github page but I've made a bit of progress so I'd like to update this thread.
My build.gradle:
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
So R8 is now enabled!
In proguard-rules.pro:
-dontobfuscate
-keep class com.shockwave.**
-printconfiguration proguard.debug.txt
-dontobfuscate I'm turning off obfuscation for now. This seems to be the key to solving my issue with R8
-keep class com.shockwave.** This is recommended by the PDFium library. Somehow, something must've changed in the latest Flutter update as this no longer solves the issue
-printconfiguration proguard.debug.txt__ This is unnecessary, I am logging my R8 flags to a file purely for debugging purposes.
Summary: This library works with R8 (with obfuscation turned off). I'd be interested if anyone knows how to get this to work with obfuscation turned on. Hope this is helpful to someone facing the same issue I am. Cheers!
This will help https://www.youtube.com/watch?v=gAUVz0U7eyA
This package works flawlessly on iOS! On Android, R8 (which is enabled by default in --release mode) is messing up this package.
Output of "flutter doctor"
Excerpt from my app level build.gradle file:
In proguard-rules.pro placed in the same directory as build.gradle:
-keep class com.shockwave.**
WORKAROUND (PDF loads with no issues on Android):
Change the build.gradle file to reflect the following:
Effectively, I am turning off R8 to get this package to work.
Is it possible to get this package to work in conjunction with R8 turned on?