./gradlew assemblerelease无法成功生成构建

时间:2020-04-25 17:44:32

标签: android

我正在运行命令:

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

1 个答案:

答案 0 :(得分:1)

我在年级下使用以下几行来解决

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'
    }
}