Pdfium for Android: Creating libpdfium.cr.so file and it is not working correctly too.

854 views
Skip to first unread message

mailga...@gmail.com

unread,
Mar 9, 2021, 2:10:17 PM3/9/21
to pdfium

Hi all,

I'm having trouble building libpdfium.so for android. I listed down the steps I followed and I'm using Ubuntu 20.04.
  1. git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
  2. export PATH=$PATH:/data/depot_tools/
  3. cd /source/
  4. gclient config --unmanaged https://pdfium.googlesource.com/pdfium.git
  5. echo "target_os = [ 'android' ]" >> .gclient
  6. gclient sync
  7. cd pdfium
    ./build/install-build-deps-android.sh
  8. gclient runhooks
  9. Added “FPDFSDK_EXPORTS” to defines in “pdf_common_config” section of BUILD.gn file.
  10. gn gen out
  11. cd out
    vim args.gn
  12. Added the following to args.gn file.
    is_debug = false
    target_os = "android"
    target_cpu = "x86"

    pdf_is_standalone = true
    is_component_build = true
    pdf_enable_xfa = false
    pdf_enable_v8 = false
    pdf_use_skia_paths = false
    pdf_use_skia = false
    symbol_level = 1
  13. cd /data/build/source/pdfium
    ninja -C out
I'm getting a libpdfium.cr.so file of having a size of 3.9MB, but when I added this to an android viewer project, it is not working as expected. I'm using the following projects as the viewer (https://github.com/mshockwave/PdfiumAndroid and https://github.com/mshockwave/PdfiumAndroid-Demo-App).

I replaced libpdfium.so file of above project with my newly build libpdfium.so (I renamed libpdfium.cr.so as libpdfium.so)

Can someone please help to me figure out what is wrong in my steps?

Thank you
Best regards
Gayashan Rathnavibushana

Paulo Coutinho

unread,
Mar 26, 2021, 1:56:58 AM3/26/21
to pdfium
Reply all
Reply to author
Forward
0 new messages