Home > front end >  Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal error in jenkins when buil
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal error in jenkins when buil

Time:10-07

I am using Jenkins 2.346.3 to build my android project apk. It was working fine when the project was using Android gradle plugin v3.6.4 and gradle version-5.6.4.

But when I updated Android gradle plugin to v4.2.2 and gradle version to v6.7.1, jenkins is giving error when building the project. It running fine when building in Android studio.

I have already updated gradle of jenkins to use v6.7.1 when building.

This is the error I am getting :

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':anothersimpletooltip:mergeDebugJniLibFolders'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:200)
        at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:263)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:198)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:179) 
......

Caused by: java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
    at org.apache.xerces.jaxp.DocumentBuilderImpl.newDocument(Unknown Source)
    at com.android.ide.common.resources.DataMerger.writeBlobTo(DataMerger.java:322)
    at com.android.ide.common.resources.AssetMerger.writeBlobTo(AssetMerger.java:28)
.......

org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:271)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:260)
    at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$0(ExecuteStep.java:33)
    at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33)

......
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal
    ... 105 more

CodePudding user response:

If someone encounters the same issue :

Turns out I needed to upgrade the java version from 8 to 11 and compileSdkVersion of the project from 30 to 31. And it worked

  • Related