7

I build a project in react-native and it works fine on my computer, but after change its location the problem starts to happen. I installed the package using "yarn add @react-native-community/async-storage"

I tried to npm install, re-install the component with yarm, and others.

"dependencies": {
    "@react-native-community/async-storage": "^1.4.2",
    "react": "16.8.3",
    "react-native": "0.59.9",
    "react-native-vector-icons": "^6.5.0",
    "react-redux": "^7.1.0",
    "redux": "^4.0.1"
},

FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring project ':@react-native-community_async-storage'.

    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 '/Users/matheus/Desktop/TicTaeToe/android/local.properties'.

tk421
  • 5,775
  • 6
  • 23
  • 34
Matheus Weber
  • 247
  • 1
  • 4
  • 13

3 Answers3

3

create a file in the android folder called local.properties

In this file write the path to your sdk, example: sdk.dir=C:\Users\ialluego\AppData\Local\Android\Sdk

(ialluego is your username)

IvanAllue
  • 434
  • 3
  • 11
0

Basically its like You are building an apk without sdk , android sdk is required to build an app in react native and sdk`s path is located inside your system somewhere like

C:\Users\NameOFYourSystem\AppData\Local\Android\Sdk

So to do this you can create local.properties file in android folder of your app and map the sdk.dir= above path

thats it all it needs one line in locaal.properties

DEEPAK
  • 1,364
  • 10
  • 24
-1

this problem happened in windows because of slashes

in your project folder navigate to android and open local.properties file

replace

sdk.dir=C:\Users\\<userName>\AppData\Local\Android\Sdk

with

sdk.dir=C:\\Users\\<userName>\\AppData\\Local\\Android\\Sdk

and it will work correctly

BranchDev
  • 144
  • 1
  • 10