android/codelab-android-databinding

Project not buildable after inital checkout when using OpenJDK

Opened this issue · 1 comments

Error thrown while building:
e: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

JDK:

openjdk 14.0.2 2020-07-14
OpenJDK Runtime Environment (build 14.0.2+12-Ubuntu-120.04)
OpenJDK 64-Bit Server VM (build 14.0.2+12-Ubuntu-120.04, mixed mode, sharing)

Android Studio version: 4.2 RC1
OS: Ubuntu 20.04.2 LTS

No changes were made to the project. Simply cloning and trying to build as instructed by the Code Lab.

For those who may have this issue, I've managed to solve it by upgrading Gradle plugin:

  • On project level build.gradle (not app level), I've updated from 3.4.0 to 4.2.0:
    classpath 'com.android.tools.build:gradle:4.2.0'

  • On gradle-wrapper.properties file, I've updated from 5.1.1 to 6.7.1:
    distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip.

Then I synced the project again and I was able to run the project with no errors.

Hope it helps 😃