Neither ANDROID_SDK_ROOT in bashrc nor sdk.dir in local.properties is working

I am trying to run react-native run-android inside of a CentOS desktop. I get the following error:

Could not determine the dependencies of task ‘app:installDebug’.

SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project’s
local properties file at
‘/home/daniel.cortes/Projects/poc_mobile/android/local.properties’.

So first I go to the root of the react native project and then to the android/ folder. In there I create a file called local.properties and add: sdk.dir = /home/daniel.cortes/Android/sdk.

I run react-native run-android again and get the same error. So I tried the second option which was to go to vim ~/.bashrc and add export ANDROID_SDK_ROOT=$HOME/daniel.cortes/Android/sdk, which I did. Then I ran source ~/.bashrc and then ran react-native run-android and I am still getting the same error. What gives here?

Answer

Try opening the android/ folder with android studio and let it auto sync. It should generate a local.properties file to resolve this issue.

Leave a Reply

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