Android JRE System library (java.awt.*) is missed

后端 未结 5 960
眼角桃花
眼角桃花 2020-12-21 05:10

I\'m trying to run pdfbox.jar library on Android and seems like I do everything right. I use Eclipse pluging to deploy the project. The code is very simple just call for pd

相关标签:
5条回答
  • 2020-12-21 05:18

    This one works perfectly! ;-)

    Birdbrain2/PdfBox-Android

    Had the same problem, and it solved it. Hope this helps!

    0 讨论(0)
  • 2020-12-21 05:20

    Android does not include most of the java.awt.* classes, and so third-party Java libraries that depend upon such classes would need to be rewritten to work on Android, or simply not used.

    I can't use jars which are depend on jre libraries that dalvik doesn't know to use.

    More accurately, you cannot use JARs which depend on classes that the Android SDK does not include.

    0 讨论(0)
  • 2020-12-21 05:31

    The problem is due to the lack of AWT support in android, as others have indicated. A work-around for you could be to use the android port of PDFBox:

    https://github.com/Birdbrain2/PdfBox-Android

    tldr; replace your gradle dependency on PDFBox with this: org.apache:pdfbox-android:latest version here, and consider adding MultiDex support to your app if you get a DexIndexOverflowException exception.

    0 讨论(0)
  • 2020-12-21 05:41

    The problem is that Android has minimal support for AWT.

    This is one of those areas where it is clear that Android is NOT a Java platform. Android has its own stack for doing graphics and GUIs.

    I'd like to know whether there is any solution ...

    This SO question - Using awt with android - has an answer mentions a commercial product that allows you to run Swing code on Android. I don't know for sure, but I imagine that this product supports AWT as well.

    0 讨论(0)
  • 2020-12-21 05:41

    The only part of AWT supported by Android is the fonts package.

    Porting AWT graphics code to Android

    0 讨论(0)
提交回复
热议问题