How to fix "Android license status unknown" in flutter

Semac picture Semac · Jan 8, 2019 · Viewed 15.5k times · Source

my flutter doctor -v result:

[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [Version 10.0.17134.472], locale fa-IR)
    • Flutter version 1.0.0 at C:\Android\flutter
    • Framework revision 5391447fae (6 weeks ago), 2018-11-29 19:41:26 -0800
    • Engine revision 7375a0f414
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at c:\Android\android-sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 27.0.3
    • ANDROID_HOME = C:\Android\android-sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
    X Android license status unknown.

[√] Android Studio (version 3.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 29.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] Connected device (1 available)
    • HUAWEI CUN U29 • CCMBBCB6C0153603 • android-arm • Android 5.1 (API 22)

and when run:

flutter doctor --android-licenses

get me this result:

A newer version of the Android SDK is required. To update, run:
c:\Android\android-sdk\tools\bin\sdkmanager --update 

and when update sdkmanager show this error to me:

 Exception in thread "main" java.lang.NoSuchFieldError: FN_AAPT2
        at com.android.sdklib.BuildToolInfo.<init>(BuildToolInfo.java:362)

How can i solve this challenge?

Answer

Nithesh picture Nithesh · Aug 9, 2019

I have followed these steps. It worked for me.

  1. went to Environment variables and added ANDROID_HOME with a variable value of: C:\Users\%username%\AppData\Local\Android\Sdk

  2. then my JAVA_HOME with this variable value: C:\Program Files\Android\Android Studio\jre

  3. then my Path with this variable value: C:\Users\%username%\flutter\bin

  4. then I ran the following command

    flutter doctor
    
  5. Got the output of Doctor summary (to see all details, run flutter doctor -v):

    [√] Flutter (Channel beta, v0.2.3, on Microsoft Windows [Version 10.0.16299.309], 
    locale en-US)
    [!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor -- 
    android-licenses
    [√] Android Studio (version 3.1)
    [√] Connected devices (1 available)
    
    ! Doctor found issues in 1 category.
    
  6. Then I ran
    flutter doctor --android-licenses
    
    and accepted all Terms & Conditions with (y)