gpt4 book ai didi

java - Gradle lint 和测试构建错误 - JAXBException 和库中无效的包引用

转载 作者:太空宇宙 更新时间:2023-11-04 09:31:14 27 4
gpt4 key购买 nike

今天我试图将一个 Android 项目添加到 CIRCLE CI,我正在其中运行 ./gradlew lint 测试作为构建是否通过的检查。问题是我遇到了一些烦人的错误,我花了几个小时才解决它们:

在我的本地计算机上,我得到:java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

并且在 CIRCLE CI 上抛出以下错误:

The first 3 errors (out of 10) were: /home/circleci/.gradle/caches/modules-2/files-2.1/javax.activation/activation/1.1.1/485de3a253e23f645037828c07f1d7f1af40763a/activation-1.1.1.jar: Error: Invalid package reference in library; not included in Android: java.awt.datatransfer. Referenced from javax.activation.ActivationDataFlavor. [InvalidPackage] /home/circleci/.gradle/caches/modules-2/files-2.1/javax.activation/activation/1.1.1/485de3a253e23f645037828c07f1d7f1af40763a/activation-1.1.1.jar: Error: Invalid package reference in library; not included in Android: java.awt.event. Referenced from com.sun.activation.viewers.TextEditor. [InvalidPackage] /home/circleci/.gradle/caches/modules-2/files-2.1/javax.activation/activation/1.1.1/485de3a253e23f645037828c07f1d7f1af40763a/activation-1.1.1.jar: Error: Invalid package reference in library; not included in Android: java.awt. Referenced from com.sun.activation.viewers.ImageViewer. [InvalidPackage]

我在我的 android 项目中使用数据绑定(bind)以及 livedata 和 androidx。我已经在网上搜索了几个小时,但没有任何帮助。我尝试用以下方法消除错误:

lintOptions {
错误中止 true
lint配置文件(“lint.xml”)
}

和 lint.xml:

<lint>
<issue id="InvalidPackage">
<ignore path="**/activation*.jar"/>
</issue>
</lint>

预先感谢您的帮助。如果需要,请索取更多信息!

最佳答案

@Gabi 我能够在公共(public) github 存储库 + Circleci 中复制该问题并解决它。

请参阅以下公共(public) android-practice github 存储库提交历史记录:https://github.com/ejparz/android-practice/commits/master

作为本次提交的一部分,我让相应的 CircleCi 构建正常工作。

提交:https://github.com/ejparz/android-practice/commit/b5f4b20a2adc3ef828153b39869f766ee7e9920e

构建:https://circleci.com/gh/ejparz/android-practice/6

<小时/>

然后我添加了一个无效的包(javax.activation:activation),并在相应的circleci构建中得到了与您相同的错误

提交:https://github.com/ejparz/android-practice/commit/ca6f502170439e28cbcf269eac302369a282d7d0

构建:https://circleci.com/gh/ejparz/android-practice/7

请注意,该构建具有与您报告的相同的错误错误:库中的包引用无效; Android 中未包含:java.awt.datatransfer。引用自 javax.activation.ActivationDataFlavor

<小时/>

然后,我通过在应用程序模块的根目录添加 lint.xml 文件来修复错误

提交:https://github.com/ejparz/android-practice/commit/7e9f7ca030370570e55c34201fd6f568e049279e

构建:https://circleci.com/gh/ejparz/android-practice/8

现在构建成功了!

<小时/>

请注意,lint.xml 文件的位置非常重要。它不能进入​​项目的根目录。它必须位于模块的根目录(如其他 SO 帖子所示: Firestore: Invalid package reference in library )

请告诉我这是否适合您。

关于java - Gradle lint 和测试构建错误 - JAXBException 和库中无效的包引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57075506/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com