简体   繁体   English

在Android中构建PDFium

[英]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). 我必须为我的Android应用程序添加PDF阅读器支持(现在我正在使用Mupdf,但我需要更改它)。

I found PDFium project ( https://code.google.com/p/pdfium/ ) and I think it is what I need for my needs. 我找到了PDF项目( https://code.google.com/p/pdfium/ ),我认为这是我需要的。
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. 我在Android上没有太多经验而且我无法为Android构建它,我已经按照https://code.google.com/p/pdfium/wiki/Build中的构建说明进行操作效果很好。

Could you give some hint or advice to achieve build this tool in Android? 您能否提供一些提示或建议来在Android中构建此工具?

Thank you in advance!!! 先感谢您!!!

Build it within the AOSP 在AOSP中构建它
https://android.googlesource.com/platform/external/pdfium/ https://android.googlesource.com/platform/external/pdfium/
Use mm or mma instructions to build only the pdfium module 使用毫米MMA指令只建了pdfium模块

I've only successfully built the shared library but haven't take it into practice. 我只是成功构建了共享库,但没有将其付诸实践。

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. 我建议在Linux上构建(虚拟机就足够了),因为Windows正式不受支持,并且在较新版本的OS X上存在许多问题。

You will need about 60 GB of free space. 您将需要大约60 GB的可用空间。

  • install OpenJDK 8 安装OpenJDK 8
  • $ mkdir ~/android_src && cd ~/android_src or select any other path $ mkdir ~/android_src && cd ~/android_src或选择任何其他路径
  • $ repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.1_r28

    (detailed description available here ) (详细说明在这里

  • $ repo sync and wait... $ repo sync并等待......
  • clone this repo (or download zip with its content) 克隆此repo(或下载zip及其内容)
  • replace makefiles in ~/android_src with corresponding makefiles from this repo 用这个repo中的相应makefile替换~/android_src makefile
  • $ cd ~/android_src
  • $ source build/envsetup.sh
  • $ cd external/pdfium/fpdfsdk
  • $ lunch and select architecture $ lunch和精选建筑
  • $ mma and wait ~5 minutes $ mma等待~5分钟
  • library is available in ~/android_src/out/target/product/generic*/obj/lib/libmod*.so , copy it somewhere 库可以在~/android_src/out/target/product/generic*/obj/lib/libmod*.so ,复制到某个地方
  • $ rm -r ~/android_src/out before next build $ rm -r ~/android_src/out在下次构建之前

It worked for me, but if doesn't work for you, try installing additional packages listed here . 它适用于我,但如果不适合您,请尝试安装此处列出的其他软件包。

Source 资源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM