将itextg添加到gradle中

G_V*_*G_V 1 android itext android-gradle-plugin itextg

我想通过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'
}
Run Code Online (Sandbox Code Playgroud)

常规itext工作正常,但我正在尝试用图像做事.

compile 'com.itextpdf:itextpdf-5.5.6'
Run Code Online (Sandbox Code Playgroud)

Ame*_*sse 8

我想这是因为我们发布的iText作为一个jarMaven的中央(其中摇篮也使用作为存储库),并从不同的网站(下载GitHub的,在SourceForge); 但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'
}
Run Code Online (Sandbox Code Playgroud)

  • 我尝试添加5.5.11但是没有用,5.5.9就是这样.奇迹般有效 (3认同)