scientifichackers / flutter_pdf_viewer

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

AbiFilters and AppBundle #36

Open d-apps opened 4 years ago

d-apps commented 4 years ago

Is there any workaround I could do to be able to build appbundle with pdf compatible with both archs instead of building 2 APKs with different abifilters, since appbundle optimize the app and reduce the app size?

phaylali commented 4 years ago

@devxpy hey brother , we would really appreciate it if you updated this package with the fix for release version , everything else about this package is just perfect , it is the best pdf package for flutter , I may have noticed something that could be the source of the problem , here , in class PdfViewer {static const channel = MethodChannel('com.pycampers.flutter_pdf_viewer');} , but when you check the android (kotlin) package you find com.pycampers.flutterpdfviewer , also you changed the name of pycampers to scientifichackers , idk if this is causing the problem or part of it , but I hope you can fix it

phaylali commented 4 years ago

I did an adb log for my app which in that case was installed by release apk ,and it gave me this error E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method launchPdfActivity on channel com.pycampers.flutter_pdf_viewer) it doesn't give that error on debug mode

d-apps commented 4 years ago

I did an adb log for my app which in that case was installed by release apk ,and it gave me this error E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method launchPdfActivity on channel com.pycampers.flutter_pdf_viewer) it doesn't give that error on debug mode

I am having the same error, it fails to call the native method only in x64 apk version, any thoughts?

I was wondering if we could force install x86 apk instead x64 on Play Store, but I don't think it's possible. :/

devxpy commented 4 years ago

This looks like its caused by https://github.com/scientifichackers/flutter_pdf_viewer/issues/30.

Try adding the following to android/app/build.gradle

android {
    ...

    buildTypes {
        release {
            ...

            shrinkResources false
            minifyEnabled false
        }
    }
}

If you really want to have code obfuscation and have the patience to do it, then you may try writing specific proguard rules to avoid the plugin and its dependencies from being obfuscated.

phaylali commented 4 years ago

@devxpy can you update the package with newest gradle version and kotlin version ? it didn't get updated from august

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.