将 itextg 添加到 gradle
Adding itextg to gradle
我想通过 gradle 添加 itextg 以避免必须维护一组库 jar。也许是我,但我找不到正确的 gradle 编译语句。
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:20.0.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.itextg:itextg:5.4.3'
}
常规 itext 工作正常,但我正在尝试用图像做一些事情。
compile 'com.itextpdf:itextpdf-5.5.6'
我认为那是因为我们在 Maven Central (which Gradle also uses as a repository) and also as a download from various sites (GitHub、SourceForge 上将 iText 作为 jar
发布);但是 iTextG 只能在各种站点上下载,不能在 Maven Central 上下载。 iTextG 使用与 iText 相同的名称空间:com.itextpdf:itextpdf
因此在 Maven Central 上使用它也会产生冲突。 com.itextg:itextg
之类的东西根本不存在 (据我所知 - 我应该知道,因为我是 iText Software 的 QA 工程师)。
事实上,iText 和 iTextG 之间的主要区别在于我们从 iTextG 中剥离了所有 AWT 依赖项。对于其余部分,它们是完全相同的代码库。
因此,要在了解所有这些背景信息后最终回答您的问题:您必须下载 iTextG jar
并手动将其添加到您的 libs
文件夹中。
从 iText 5.5.9
开始,您可以将其添加到您的 Gradle 文件中:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:20.0.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.itextpdf:itextg:5.5.9'
}
我想通过 gradle 添加 itextg 以避免必须维护一组库 jar。也许是我,但我找不到正确的 gradle 编译语句。
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:20.0.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.itextg:itextg:5.4.3'
}
常规 itext 工作正常,但我正在尝试用图像做一些事情。
compile 'com.itextpdf:itextpdf-5.5.6'
我认为那是因为我们在 Maven Central (which Gradle also uses as a repository) and also as a download from various sites (GitHub、SourceForge 上将 iText 作为 jar
发布);但是 iTextG 只能在各种站点上下载,不能在 Maven Central 上下载。 iTextG 使用与 iText 相同的名称空间:com.itextpdf:itextpdf
因此在 Maven Central 上使用它也会产生冲突。 com.itextg:itextg
之类的东西根本不存在 (据我所知 - 我应该知道,因为我是 iText Software 的 QA 工程师)。
事实上,iText 和 iTextG 之间的主要区别在于我们从 iTextG 中剥离了所有 AWT 依赖项。对于其余部分,它们是完全相同的代码库。
因此,要在了解所有这些背景信息后最终回答您的问题:您必须下载 iTextG jar
并手动将其添加到您的 libs
文件夹中。
从 iText 5.5.9
开始,您可以将其添加到您的 Gradle 文件中:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:20.0.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.itextpdf:itextg:5.5.9'
}