0

I'm trying to set up flutter on my Ubuntu 19.10 machine.

When I run flutter doctor --android-licenses It prompts me to update the SDK like so -

A newer version of the Android SDK is required. To update, run:
/home/<username>/Android/SDK/tools/bin/sdkmanager --update

When I run it, I encounter an Exception - java.lang.NoClassDefFoundError

This answer suggests changing DEFAULT_JVM_OPTS in sdkmanager to

DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME" --add-modules java.xml.bind'

This seems to work in Java 9/10. However, I use Java 11 and unfortunately the java.xml.bind module and java.se.ee module has been discontinued from Java 11 -

java version "11.0.6" 2020-01-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.6+8-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.6+8-LTS, mixed mode)

Is there a way to fix this in Java 11? Or do I have to downgrade to Java 9/10?

jindan
  • 878
  • 1
  • 6
  • 9

1 Answers1

0

flutter supports java 1.8 so, try install java 1.8

longxz
  • 11
  • 3
  • Note: answers that are very brief and/or are questions back to the poster should probably be comments. You only need 50 rep points to comment under a question - could you move this there? – Tyler2P Dec 28 '20 at 13:15