Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build PDFium in Android

I am facing a problem. I have to add a PDF reader support to my Android App (now I'm using Mupdf but I need to change it).

I found PDFium project (https://code.google.com/p/pdfium/) and I think it is what I need for my needs.
I haven't too much experience in Android and I've not been able to build it for Android, I've followed the build instructions from here https://code.google.com/p/pdfium/wiki/Build with no good results.

Could you give some hint or advice to achieve build this tool in Android?

Thank you in advance!!!

like image 315
peskarolo Avatar asked Oct 23 '14 16:10

peskarolo


2 Answers

How to build?

I recommend building on Linux (virtual machine will suffice), because Windows is officially not supported and there are many problems on newer versions of OS X.

You will need about 60 GB of free space.

  • install OpenJDK 8
  • $ mkdir ~/android_src && cd ~/android_src or select any other path
  • $ repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.1_r28

    (detailed description available here)

  • $ repo sync and wait...
  • clone this repo (or download zip with its content)
  • replace makefiles in ~/android_src with corresponding makefiles from this repo
  • $ cd ~/android_src
  • $ source build/envsetup.sh
  • $ cd external/pdfium/fpdfsdk
  • $ lunch and select architecture
  • $ mma and wait ~5 minutes
  • library is available in ~/android_src/out/target/product/generic*/obj/lib/libmod*.so, copy it somewhere
  • $ rm -r ~/android_src/out before next build

It worked for me, but if doesn't work for you, try installing additional packages listed here.

Source

like image 64
Ahmer Afzal Avatar answered Oct 21 '22 13:10

Ahmer Afzal


Build it within the AOSP
https://android.googlesource.com/platform/external/pdfium/
Use mm or mma instructions to build only the pdfium module

I've only successfully built the shared library but haven't take it into practice.

like image 25
shockwave Avatar answered Oct 21 '22 14:10

shockwave