8

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!!!

dj2
  • 9,534
  • 4
  • 29
  • 52
peskarolo
  • 133
  • 2
  • 5
  • What specifically happened? Compilation errors? Link errors? We can diagnose error messages, but can't do anything with "it didn't work". – Dan Albert Oct 24 '14 at 01:30
  • I've followed build instructions and I've generated a Visual Studio project. But now I don't know how to continue... Do I need to build now with Android NDK? I'm quite lost in this momment... – peskarolo Oct 24 '14 at 07:27
  • 2
    Whose build instructions? Some quick searching didn't turn up any guides on building pdfium for Android. Yes, you'll need to build with the NDK. – Dan Albert Oct 26 '14 at 17:53
  • I'm searching for Android build instructions too... I'm totally ignorant about NDK and C compilation for android, so a quite detailed guide could help... – N Dorigatti Jan 16 '15 at 15:40
  • @peskarolo Have you successfully build pdfium , Where i can find step to build it. – Herry Nov 05 '15 at 11:09

2 Answers2

4

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

Ahmer Afzal
  • 501
  • 2
  • 11
  • 24
3

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.

shockwave
  • 145
  • 1
  • 11