android - ./gradlew assemblerelease 生成构建失败
问题描述
我正在运行命令:
admins-MacBook-Pro:launcher devrath$ ./gradlew assemblerelease
我明白了。错误为:
> Task :app:compileGalileoReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileGalileoReleaseJavaWithJavac'.
> javax/xml/bind/JAXBException
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
22 actionable tasks: 1 executed, 21 up-to-date
我已经添加了这些依赖项:
implementation "org.glassfish.jaxb:jaxb-runtime:2.3.2"
implementation "jakarta.xml.bind:jakarta.xml.bind-api:2.3.2"
我在用 :
admins-MacBook-Pro:~ devrath$ javac -version
javac 13.0.2
解决方案
我在等级中使用以下行解决了
if (JavaVersion.current().ordinal() >= JavaVersion.VERSION_1_9.ordinal()) {
// If you're using @AutoValue or any libs that requires javax.annotation (like Dagger)
compileOnly 'com.github.pengrad:jdk9-deps:1.0'
compileOnly 'javax.annotation:javax.annotation-api:1.3.2'
// If you're using Java
annotationProcessor "com.sun.xml.bind:jaxb-core:2.3.0.1"
annotationProcessor "javax.xml.bind:jaxb-api:2.3.1"
annotationProcessor 'com.sun.xml.bind:jaxb-impl:2.3.2'
testAnnotationProcessor "com.sun.xml.bind:jaxb-core:2.3.0.1"
testAnnotationProcessor "javax.xml.bind:jaxb-api:2.3.1"
implementation "javax.annotation:jsr250-api:1.0"
// If you're using Kotlin
if (project.hasProperty('kapt')) {
kapt 'javax.xml.bind:jaxb-api:2.3.1'
kapt 'com.sun.xml.bind:jaxb-core:2.3.0.1'
kapt 'com.sun.xml.bind:jaxb-impl:2.3.2'
}
}
推荐阅读
- python - 使用 sqlite3 和 python 创建新的 SQLite 表,将其他表中的列组合起来
- python - Python:希望在同一个窗口中显示多个图形
- bash - 使用 bash 脚本解析日志文件
- javascript - 排序对象的JS对象(嵌套)
- python-2.7 - 将字符串变量添加到 readlines 结构中每个字符串的开头
- python - 对将在 n 个周期内发生的 Logistic 回归事件进行编码。在熊猫
- python - 在python中获取时间戳差异的方法
- javascript - 如何在 JavaScript 中检查邮政编码?
- laravel - Laravel PDF 到图像:ImagickException:未授权
- json - 如何在powershell中替换json文件中的属性