'Flutter is not finding android sdk

Whenever i run flutter doctor the following error comes

[√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 
10.0.22000.438], locale en-IN)
[!] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
 X Android SDK file not found: C:\Users\rehan\AppData\Local\Android\Sdk\build-tools\32.1.0-rc1\aapt.
[√] Chrome - develop for the web
[√] Android Studio (version 2021.1)
[√] VS Code (version 1.63.2)
[√] Connected device (2 available)

 ! Doctor found issues in 1 category.


I have tried uninstalling and reinstalling android studio, and 
 adding platform and platform tools to the system environment path  

The below i have added the photo of cmd [1]: https://i.stack.imgur.com/SoK8I.jpg



Solution 1:[1]

  1. You can try this:

flutter config --android-sdk <path-to-your-android-sdk>

  1. Also you can add the sdk path to Environment variables.

    --> Open system properties
    --> Environment variables
    --> create new system variable
    --> name: ANDROID_HOME
    --> value: your SDK path
    --> close your current cmd, and restart it
    --> run flutter doctor

  2. Another one you can try to check the path to your sdk (C:\Users\rehan\AppData\Local\Android\Sdk\build-tools\32.1.0-rc1\aapt) And if the folder in C:\...\build-tools\ don't contain aapt.exe deleting this folder. Restart cmd and try the doctor again.

Solution 2:[2]

I have the same problem and Deleting my build tool and installing through android studio works for me

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aleksey Mukovin
Solution 2 Olufemi