DEV Community

loading...

Fix Flutter doctor failed due to java.lang.NoClassDefFoundError

Heddi Nabbisen
An ICT designer/developer and a security monk with "a cool brain and a warm heart". OpenBSD/Rust etc. Interested in social issues and relationships. Founder of Scqr Inc.
・2 min read

Trouble

I updated Flutter version on my Arch Linux to 2.2.0 today.
Then I met the error "Android license status unknown." in running flutter doctor for my first time. It was strange because I had already run flutter doctor --android-licenses. Anyway, there was no way except running it again. And the result was:

Console error

Thus, I got "java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema". Puzzled.

Solution

Thanks to Github Flutter issues (51670 / 56778) and ぶるー's zenn.dev post, I solved it via Android Studio settings.

Start Android Studio.
Go to [ File ] -> [ Settings ] in main menus.

Android Studio main menus

In Settings, go to [ Appearance & Behavior ] -> [ System Settings ] -> [ Android SDK ].
Activate "SDK tools" tab.
Choose "Android SDK Command-line Tools". Click "OK".

Android Studio Settings

Go on.

Android Studio Android SDK

The command-line tools will be installed.

Confirmation

Done.

Result

flutter doctor --android-licenses printed the process had been successful.

Successful

Then flutter doctor, too🙂

flutter doctor completed

Discussion (2)

Collapse
pablonax profile image
Pablo Discobar

If you are interested in this topic, you can also look at my article about free vs paid Flutter templates. I'm sure you'll find something useful there, too.  - dev.to/pablonax/free-vs-paid-flutt...

Collapse
nabbisen profile image
Heddi Nabbisen Author

@pablonax
Hi, thank you for your kindness, giving me useful information😄
I found it very interesting!!!