How to Solve Java Error in Android Licenses with Flutter Doctor

0
118
How to Solve Java Error in Android Licenses with Flutter Doctor

When you try to construct gradle using the newest Android SDK tools in Java and download them via the command line to install SDKs, you get the following error:

platforms;android-27 Android SDK Platform 27.0.3 build-tools Android SDK 27.0.3 build-tool. To create this project, accept the SDK licensing terms and use the Android Studio SDK Manager to add any missing components.

You can solve this issue on your own, or you can consult any leading Flutter Agencies in the USA to solve your problem. Companies can guide you properly with expert advice and solutions. Please make sure you check out their blogs for the latest articles and news.

C:\Users\pokur>flutter doctor

Doctor summary (to see all details, run flutter doctor -v):

Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19042.1110], locale en-US)

[!] Android toolchain – developed for Android devices (Android SDK version 31.0.0)

X Android license status unknown.

Run flutter doctor –android licenses to accept the SDK licenses.

See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

Chrome – develop for the web

Android Studio (not installed)

VS Code (version 1.58.2)

Running flutter doctor may result in the following error:

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.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)

at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)

Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema

at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)

at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)

at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)

As a result of this error, you will be unable to compile your project and will likely require to hire flutter developers. However, if you prefer to resolve this issue independently, we have listed down the best solution in this blog.

Why do users in Flutter receive an Android License Status Unknown error?

Typically, this type of issue happens when the user updates the Android SDK, as the licensing may have changed. Flutter may or may not remember whether or not you agreed to the changes when you were requested to accept them during the upgrade.

Users can experiment with the following command at a command prompt:

flutter doctor —android-licenses

This should ask you to accept the license; simply write y and press enter to proceed.

If you already have android studio installed, the correct solution is as follows:

  •   Launch the SDK manager.
  •   Uncheck the box at the bottom of SDK tools that says “Hide outdated packages.”
  •   Then, an option called Android SDK Tools should appear.
  •   Verify and apply, then wait for the studio to download the package.
  •   Once you’ve executed the command flutter doctor, you should be prompted to execute flutter doctor –android-licenses. Once you’ve executed the license command, press y to accept all licenses. This should resolve the issue.

Additionally, you may undertake the following steps:

STEP 1: ANDROID LICENSES

STEP 2: Since you’ve arrived at the “Android License Status Unknown” page, you’ve reached the “Android Toolchain License Status Unknown” page. As many have advised, try flutter doctor –android-licenses. If you are okay with all the configuration, It should prompt for a yes and then prompt for y.

STEP 3: Open Android Studio, navigate to File->Settings->System settings(left tab) ->Android SDK, navigate to the SDK Tool section on that page, untick hide outdated packages, pick Android SDL tools(obsolete), and click apply.

STEP 4: Repetition of Step 1.

Repeat Step 1 upon installation in a fresh command line to verify that it is operating properly; otherwise, go to STEP 4.

STEP 5: Update the SDK management

It will prompt you to update the SDK; simply type the following command in the terminal:

C\Users\__\local\Android\sdk\tools\bin\sdkmanager –update

STEP 6: JAVA 8.1 and the path to the JAVA HOME directory.

Install Java 8.1 and configure the JAVA HOME environment variable. Ascertain that it is version 8.1. Create a free account and download Oracle’s 8.1 version; keep in mind that versions higher than 11 will not operate with flutter.

Subsequent to introducing and appropriately arranging the way, execute C\Users\__\local\Android\sdk\tools\bin\sdkmanager – update order

 STEP 7: Restart the flutter doctor As you can see, it indicates that the command flutter doctor –android-licenses should be executed. Therefore, on the terminal, type flutter doctor –android-licenses and hit y when prompted.

We hope this guide was helpful in resolving your issue.

This article is presented by Flutter Agency, a leading company dedicated to offering various mhealth solutions for healthcare industries by providing custom hospital apps for patients to manage their data medical records, bills, and other diagnostic information. Consult for doctor app solutions.

Read more interesting articles at Blog Junta