Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Android version 5.1.1, plugin not working #72

Closed
kisrar opened this issue Feb 11, 2024 · 8 comments
Closed

On Android version 5.1.1, plugin not working #72

kisrar opened this issue Feb 11, 2024 · 8 comments

Comments

@kisrar
Copy link

kisrar commented Feb 11, 2024

Screenshot that I received from my Production App user:

Screenshot_2024-02-11-10-55-07-43

So my question is, is the plugin compatible with Android 5?

@espresso3389
Copy link
Owner

Basically I have no idea what Android versions actually supported.

pdfrx depends on bblanchon/pdfium-binaries and searching the source code shows me it uses:

https://github.com/bblanchon/pdfium-binaries/blob/c05ee82d7afe7b5b067dbe01befcc9e6eef83ede/steps/08-test.sh#L12-L26

case "$OS" in
  android)
    case "$CPU" in
      arm)
        PREFIX="armv7a-linux-androideabi19-"
        ;;
      arm64)
        PREFIX="aarch64-linux-android21-"
        ;;
      x64)
        PREFIX="x86_64-linux-android21-"
        ;;
      x86)
        PREFIX="i686-linux-android19-"
        ;;

https://github.com/bblanchon/pdfium-binaries/blob/c05ee82d7afe7b5b067dbe01befcc9e6eef83ede/steps/01-install.sh#L24

  • ANDROID_NDK_VERSION="r25c"

And, according to NDK r25c releasenote, it still supports APIs 19 and 20. (It seems SDK r26 removes the support).

So,

  • for arm/x86 binaries, it supports 19+
  • for arm64/x64, it supports 21+

pdfrx does not specify any explicit NDK version and minSdkVersion is set to 19.

And Android 5.1.1 is 22. Is is really a Android version error??

Anyway, the screen explains that the library is correctly loaded but FPDF_InitLibraryWithConfig is not found.
I could not determine whether it is a Android version error or not.

By the way, the error screen can be replaced if you implement PdfViewerParams.errorBannerBuilder.

@kisrar
Copy link
Author

kisrar commented Feb 11, 2024

Hi @espresso3389, as now I am only using the pdfrx plugin, so many of my production users reported this issue.
In order to verify the pdfrx plugin behaviour, I created an emulator with API level 22 (Android 5.1). It seems the pdfrx plugin is not working on that version (attaching the screenshot of the emulator for your reference).
image

Let me know if the solution is feasible, else I will have to use pdfrx with old pdf plugins as well to support the Android 5.1+ devices.

@espresso3389
Copy link
Owner

I found a post:
bblanchon/pdfium-binaries#147 (comment)

Chromium dropped support for Android API 23 a year ago:
https://groups.google.com/a/chromium.org/g/chromium-dev/c/z_RvoPoIeoM

So the final answer is; pdfrx runs on API 24+ or later.

@espresso3389
Copy link
Owner

According to several statistics, Android 5/6 share is smaller than 3%.

It's not worth supporting them.

@espresso3389
Copy link
Owner

Because the deprecation starts on Oct 2022, the releases before pdfium-binaries 5323 may be frx the issue.

So creating a fork that changes the release version to them may work.

@espresso3389
Copy link
Owner

I've tested PDFium 106.0.5215.0 with

patching pdfrx/android/CMakeLists.txt with the following diff:

# PDFium 106.0.5215.0
# Aug 3, 2022
# https://github.com/bblanchon/pdfium-binaries/releases/tag/chromium%2F5215
set(PDFIUM_RELEASE chromium%2F5215)

and run it on API 22 simulator. And the result is same. It does not find FPDF_InitLibraryConfig...

@espresso3389
Copy link
Owner

Interesting things here is that FPDF_InitLibrary, FPDF_GetPageCount, FPDF_GetDocPermissions can be called correctly.
So, if I replaces call to FPDF_InitLibraryConfig with FPDF_InitLibrary, the next exception occurred when calls FPDF_GetSecurityHandlerRevision.

Apparently functions such as FPDF_InitLibrary and FPDF_GetSecurityHandlerRevision calls some Android API functions that is not supported on API 22.

I didn't have time to investigate the issue further. So anyway, currently I cannot support Android API 22.

@kisrar
Copy link
Author

kisrar commented Feb 15, 2024

Thanks a lot @espresso3389 for the pdfrx plugin.
So, to support the old devices as well, I am using the pdfrx in conjunction with pdf_render plugin.
For now, it is OK, but ultimately I will find a solution to use only a single plugin (as using 2 plugins increased the app size as well).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants