Sdkmanager failure

after using upgrading android gradle plugin 7.0.2
i had to upgrade oraclejdk to oraclejdk11

from now i get this error related to sdkmanager

$ yes | sdkmanager "platforms;android-29"
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
	at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
	at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
	at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
	at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:103)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	... 4 more

my travis file

if: tag IS blank

language: android
android:
  components:
    - tools
    - platform-tools
    - tools
    - build-tools-29.0.3
    - android-29

jdk:
  - oraclejdk11

dist: trusty

notifications:
  slack: inmobly:ejMYT0401w1ku3SNAg97HIJD

before_install:
  - yes | sdkmanager "platforms;android-29"

before_cache:
  - rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
  - rm -fr $HOME/.gradle/caches/*/plugin-resolution/

cache:
  directories:
    - $HOME/.gradle/caches/
    - $HOME/.gradle/wrapper/

script:
  - chmod +x build-script.sh
  - ./build-script.sh

before_deploy:
  - chmod +x before-deploy.sh
  - source before-deploy.sh

2 Likes

Thanks @AAverin, yes the fix I published in this thread should also fix your issue.

How to solve it.
What did you published? @Montana

Hey @xx394984678,

There was a similar issue posted, my response seemed to help a lot of people experiencing the same thing.

2 Likes

i tried the solution found in this repo, its very helpful :+1:

Hey @oahmedazab,

Thanks for sharing! This make sense that it works as it follows my YAML flow form my original example.

FYI my travis config can still be found here: DeveloperWidget/.travis.yml at 3680df21fe3f27d3c9ad0d872970800930730032 · G00fY2/DeveloperWidget · GitHub