Async-storage: A problem occurred configuring project ':@react-native-community_async-storage'.

Created on 13 Aug 2019  路  7Comments  路  Source: react-native-async-storage/async-storage

I want to:


Do a build for android

Details:


So I'm having an error when doing a build:

A problem occurred configuring project ':@react-native-community_async-storage'.
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath 'com.google.gms:google-services:4.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

subprojects {
    afterEvaluate { project ->
        android {
            compileSdkVersion 28
            buildToolsVersion "28.0.3"
        }
    }
}

settings.gradle

rootProject.name = 'armadillo'
include ':@react-native-community_async-storage'
project(':@react-native-community_async-storage').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/async-storage/android')

include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')

include ':react-native-device-info'
project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')

include ':react-native-config'
project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android')

include ':react-native-camera'
project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android')

include ':react-native-linear-gradient'
project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')

include ':react-native-svg'
project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android')

include ':app'

local.properties

sdk.dir = /Users/{myUserName}/Library/Android/sdk

Versions:

"@react-native-community/async-storage": "^1.6.1",
"react": "^16.8.3",
"react-native": "^0.59.0",

Most helpful comment

In my Case I used :
sdk.dir = C:\Users\Lenovo\AppData\Local\Android\sdk
in local.properties file .

Note:

If you are using your phone as emulator, keep in plugged with the USB Debugging mode ON.

This is how i solved .

All 7 comments

This was closed without a reason, @swoppy how did you solve it?

Are you using react-navigation v4.0.0? For me removing react-navigation-screens library worked and made the android app run...
Hope that helps...

@danielfein If I remember correctly, I needed to do npx jetify as I've installed a new package which is the @react-native-community/async-storage as react-native does not translate well.

@swoppy npx jetify gives:

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/jetify - Not found
npm ERR! 404 
npm ERR! 404  'jetify@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/alexchin/.npm/_logs/2019-09-19T00_58_57_758Z-debug.log
Install for [ 'jetify@latest' ] failed with code 1

yea, it appears that you do not have jetify installed. So you may wanna put that in your modules first.

yea, it appears that you do not have jetify installed. So you may wanna put that in your modules first.

yep, to do it use npm i jetifier

In my Case I used :
sdk.dir = C:\Users\Lenovo\AppData\Local\Android\sdk
in local.properties file .

Note:

If you are using your phone as emulator, keep in plugged with the USB Debugging mode ON.

This is how i solved .

Was this page helpful?
0 / 5 - 0 ratings