If we encounter this error while trying to generate an apk of a React Native application SDK location not found Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project’s local properties file, we need to do the following to fix it.
Now we will create a file called local.properties inside the Android folder of our project.
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2024/03/image-1.png?resize=429%2C71&ssl=1)
We must navigate to local.properties and add the corresponding path to the Android SDK as follows
#sdk.dir=C\:\\Users\\Android\\Sdk
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2024/03/image-2.png?resize=488%2C116&ssl=1)
This way, when trying to generate the apk of a React Native application again, the error will no longer appear.
Hope this helps. Have a great day!
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2023/07/cropped-light_logo-5.png?resize=100%2C100&ssl=1)