0
votes

Could somebody help me fix this problem? When I run react-native run-android in CMD Windows OS, I got this error.

A problem occurred configuring project ':app'. The SDK directory 'C:\Users\ABC\AppData\Local\Android\Sdk\platform-tools;C:\Users\ABC\AppData\Local\Android\Sdk' does not exist.

I searched everything to fix it but not successful.

  1. I created local.properties in android dir and add this: sdk.dir = C:\\Users\\ABC\\AppData\\Local\\Android\\Sdk
  2. Create ANDROID_HOME variable: C:\Users\ABC\AppData\Local\Android\Sdk and add to path: ...%ANDROID_HOME%platforms;%ANDROID_HOME%platform-tools but no luck.

Please help.

3

3 Answers

0
votes

You can also set android path from CMD.

set ANDROID_HOME=C:\Users\yourusername\AppData\Local\Android\sdk

set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

Note: You have to run these two commands every time you open new instance of your CMD

0
votes

If you have the same error even after configuring the environment variables like the above answer, Check the local.properties file. Most probably there can be different ANDROID_HOME path.

local.properties file located in the android folder of the react native code base.

0
votes

After installing of Android studio you need run it first and create your device. (i don't remember how but it helped for me)Untill this done you not have android folder. To watch my suggestion open C:\Users\yourusername\AppData\Local
and go to your Local folder mark 'View/show-hide/hidden items' in as on the pictures. Then open android studio, and create android device.And you will see how hidden android folder have appeared(can be seen if hidden items marked)