How to Fix Flutter Android License Status Unknown or the Run Error “You Have Not Accepted the License Agreements”?

How to Fix Flutter Android License Status Unknown or the Run Error “You Have Not Accepted the License Agreements”? - GuidingCode

Did you work all night, and when you wanted to run your Flutter project to ensure everything worked, it showed a run error saying “You Have Not Accepted the License Agreements” or the “Android license status unknown” error? Nothing is more frustrating for a developer than running into errors generated by the integrated development environment or an error that has nothing to do with their written code.

Google’s Flutter is an open-source UI software development kit (SDK) that enables programmers to construct natively built, high-performance mobile, web, and desktop applications from a single codebase.

Developers may easily construct cutting-edge, responsive user interfaces using the Dart programming language and a large collection of pre-built widgets and tools.

Flutter developers may experience various issues throughout the development process, just as with any other software development framework. Fortunately, the Flutter error you encountered: “You Have Not Accepted the License Agreements” or “Android license status unknown”, is an error that is quite easily fixable.

Flutter android license status unknown or the run error “you have not accepted the license agreements”

 

After updating your Flutter SDK, trying to use the flutter command in your terminal or IDE frequently results in the “You have not accepted the license terms” error. This issue happens due to new licensing you must accept to use the upgraded SDK.

In this article, I will explain all the steps you can take to fix this error you are encountering.

 

 

4 Fixes for Android License Status Unknown or Run Error “You Have Not Accepted the License Agreements”

1. Accept the License Agreements

Accepting license agreements for any necessary components, such as Android SDK platforms and build tools, is typical when using the Flutter SDK.

You can take the following actions to accept these licenses by using the sdkmanager --licenses command in the terminal or command prompt:

  1. Open your terminal or command prompt and navigate to the root directory of your Flutter project.
  2. Run the following command to open the Android SDK Manager:
    flutter doctor --android-licenses

    Accept the License Agreements to fix Flutter Android license status unknown or the run error “You have not accepted the license agreements”

  3. The command will display a list of licenses that need to be accepted. Review the licenses and type y to accept each one.
  4. Once you have accepted all the licenses, the command will confirm that the licenses have been installed.

Alternatively, you can also run the following command to accept all the licenses simultaneously:

flutter doctor --android-licenes --no-ui

 

All licenses are accepted by the above command without the Android SDK Management UI being displayed.

Before building and launching your Flutter app, accepting the licensing is critical; otherwise, build issues may occur.

 

 

2. Environment Variable

One approach to fixing the error while launching a Flutter project is to set the ANDROID_SDK_ROOT environment variable to the location of your Android SDK installation.

The Android SDK is normally installed in a specified directory on your computer when you install it. Your computer is instructed where to find the Android SDK installation by setting the ANDROID_SDK_ROOT environment variable.

You can follow the following steps to set the environment variable correctly:

  1. Open your system’s environment variables configuration. On Windows, you can do this by typing “environment variables” in the Start menu and selecting “Edit the system environment variables”.
  1. Click the “Environment Variables” button.
  2. Under “System Variables”, click “New”.
  3. In the “Variable name” field, enter ANDROID_SDK_ROOT.
  4. In the “Variable value” field, enter the path to your Android SDK installation directory.
  5. Click “OK” to save the environment variable.

Restart your machine after setting the ANDROID_SDK_ROOT environment variable, then try running your Flutter project again. The issue ought to be fixed right now.

 

 

3. Ensure the Correct Path

There could be spaces or other special characters in the Android SDK installation path, which could interfere with the execution of some tasks. Ensure the path to the directory where the Android SDK is installed is free of spaces and other special characters to prevent problems like this.

You can follow the steps below to check and update the path to your Android SDK installation directory:

  1. Open Android Studio and go to “File” > “Settings” (on Windows) or “Android Studio” > “Preferences” (on Mac).
  2. In the left-hand panel, click on “Appearance & Behavior” > “System Settings” > “Android SDK”.Ensuring the Correct Path to Fix Flutter Android License Status Unknown or The Run Error “you Have Not Accepted the License Agreements”
  3. Look at the “Android SDK Location” field to see the path to your Android SDK installation directory. If it contains spaces or special characters, you should move the SDK to a directory with a simpler path, such as C:\Android\ or ~/Android/.
  4. Once you’ve moved the SDK to a simpler path, update the path in the “Android SDK Location” field to reflect the new location.
  5. Click “Apply” or “OK” to save the changes.

Try launching your Flutter project once more once you’ve adjusted the path to your Android SDK installation directory. The issue ought to be fixed right now.

 

 

4. Version Compatibility

For their respective software development kits to function properly, the Flutter SDK and Android SDK must be compatible. Errors like the “You have not accepted the license agreements” error can result from the two being incompatible.

You can take the following steps to ensure that the Flutter SDK and Android SDK versions are compatible:

  1. Open Android Studio and go to “File” > “Settings” (on Windows) or “Android Studio” > “Preferences” (on Mac).
  2. In the left-hand panel, click on “Appearance & Behavior” > “System Settings” > “Android SDK”.
  3. Look for the “SDK Platforms” tab and check if the version of the Android SDK you’re using matches the requirements of the Flutter SDK you have installed.
  4. If the versions don’t match, click the checkbox next to the compatible Android SDK version and click “Apply” or “OK” to install it.
  5. Next, check the “SDK Tools” tab and make sure that the required Android SDK Build-Tools and Android SDK Platform-Tools versions are installed. If not, click the checkbox next to them and click “Apply” or “OK” to install them.

Check the version compatibility to Fix Flutter Android License Status Unknown or the Run Error “You Have Not Accepted the License Agreements”

 

Try launching your Flutter project once more after updating the Android SDK to a version that is compatible with your Flutter SDK. The issue ought to be fixed right now.

 

 

Conclusion

All the solutions described above will help you troubleshoot why the Flutter “Android license status unknown” or run error “You have not accepted your license agreement” occurs upon running your project. Most of these solutions should fix your issues, and your extension should run quickly.

Lastly, let us know in the comments:

  • Were you also unable to fix issues with your Flutter SDK?
  • Did any of the solutions work for you?
  • Is there any missed solution you would like to add to the list?

Feel free to share this article with any of your fellow developers!

 

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Total
0
Share