0

我正在尝试使用 itextg 但我遇到了一些 gradle 错误。任何想法?我尝试了 5.5.9 和 5.5.10 版本。

Execution failed for task ':app:lint'.
Lint found errors in the project; aborting build.
Fix the issues identified by lint, or add the following to your build script to proceed with errors:
...
android {
    lintOptions {
        abortOnError false
    }
}
The first 3 errors (out of 482) were:
/Users/xxxxx/.gradle/caches/modules-2/files-2.1/com.itextpdf/itextg/5.5.10/247811bfc4d8f4e99c909236eadf4dfc6dfa1615/itextg-5.5.10.jar: Error: Invalid package reference in library; not included in Android: javax.xml.crypto.dom. Referenced from com.itextpdf.text.pdf.security.MakeXmlSignature. [InvalidPackage]
/Users/xxxxx/.gradle/caches/modules-2/files-2.1/com.itextpdf/itextg/5.5.10/247811bfc4d8f4e99c909236eadf4dfc6dfa1615/itextg-5.5.10.jar: Error: Invalid package reference in library; not included in Android: javax.xml.crypto.dsig.dom. Referenced from com.itextpdf.text.pdf.security.MakeXmlSignature. [InvalidPackage]
/Users/xxxxx/.gradle/caches/modules-2/files-2.1/com.itextpdf/itextg/5.5.10/247811bfc4d8f4e99c909236eadf4dfc6dfa1615/itextg-5.5.10.jar: Error: Invalid package reference in library; not included in Android: javax.xml.crypto.dsig.keyinfo. Referenced from com.itextpdf.text.pdf.security.MakeXmlSignature. [InvalidPackage]
4

2 回答 2

4

据我了解,Android 不包含以下软件包。

javax.xml.crypto.dom
javax.xml.crypto.dsig

这就是为什么 itextpdf lib 找不到对它们的引用的原因。要修复它,请添加以下依赖项。

implementation group: 'javax.xml.crypto', name: 'jsr105-api', version: '1.0.1'
于 2018-12-21T10:25:48.710 回答
0

听起来像缺少传递库。尝试在该依赖项上使用 {transitives = true} 看看它是否有帮助。此外,看起来他们可能正在使用直接的 Java 模块来确保底层的安全性,因此您可能必须确保在 build.gradle 中指定正确的 JAVA_VERSION 以使用。

还要确认您可以将项目视图展开到 itextg 区域并看到以下 JAR 已被拉入。

itextpdf-x.y.z.jar
itext-xtra-x.y.z.jar
itext-pdfa-x.y.z.jar
xmlworker-x.y.z.jar

如果您没有看到它们,那么您可能需要下载它们并手动包含它们。我对 itext 不够熟悉,不知道它们如何包含它们的传递依赖项,但他们确实在 GitHub 上指出它们用于此,因此请确认它们在那里。

于 2018-05-09T19:51:58.850 回答