包括iTextG在采用Android Studio中的Andr​​oid项目 [英] Including iTextG in an Android Project using Android Studio

查看:955
本文介绍了包括iTextG在采用Android Studio中的Andr​​oid项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到包括iTextG在Android的工作室,

I'm getting the following error when including iTextG in Android Studio,

com.android.dex.DexException: Multiple dex files define Lcom/itextpdf/awt/geom/AffineTransform;
    at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
    at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
    at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
    at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
    at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)

我不知道为什么,但似乎有AWT这个库中了。这就是我如何包括它:

I don't know why but seems that there is awt in this library too. This is how i'm including it:

  1. http://sourceforge.net/projects/itextg/ 下载itextg
  2. 解压缩的jar文件
  3. 复制itextg-5.5.4.jar到libs文件夹中的应用程序目录
  4. 在摇篮干净
  1. Download itextg from http://sourceforge.net/projects/itextg/
  2. Extract the jar file
  3. Copy itextg-5.5.4.jar to the libs folder in the app directory
  4. Gradle clean

为什么AWT还是在图书馆?

Why is the awt still in the library ?

推荐答案

请仔细阅读例外。它谈论 com.itextpdf.awt 。这是不一样的禁 java.awt中的

Please read the exception carefully. It talks about com.itextpdf.awt. That is not the same as the forbidden java.awt.

您指控的 AWT仍然在库的是错误的。该 com.itextpdf.awt 包是否有更换禁止AWT类。这些替代类本身是完全有效的,并且可以在Android中使用。

Your allegation that awt is still in the library is wrong. The com.itextpdf.awt package is there to replace the forbidden AWT classes. Those replacement classes as such are perfectly valid and can be used on Android.

您所遇到的问题,在错误信息说明:类 com.itextpdf.awt.geom.AffineTransform 在不同的DEX文件中定义。这意味着,你正在使用的不仅仅是iTextG 5.5.x.你有一个以上的iTextG您的设备上。它们全部删除,并确保你iTextG的添加只有一个实例。

The problem you are experiencing is explained in the error message: the class com.itextpdf.awt.geom.AffineTransform is defined in different DEX files. This means that you are using more than just iTextG 5.5.x. You have more than one iTextG on your device. Remove them all and make sure you add only a single instance of iTextG.

这篇关于包括iTextG在采用Android Studio中的Andr​​oid项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆