How to Fix Gradle Errors Sync Error with New React-Native Project for Android and iOS

I am trying to start using React-Native for some of my mobile developments. Most of them seem very straightforward from React-Native Docs on Github, but I can't get projects to create in Android Studio.

When I try to import a project by going to ProjectName / android / app and selecting import, I get this when the project tries to build.

SDK Location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable. 

SDK location not found screenhsot

I re-deleted and updated the local.properties file several times to see if this helped. This is not true. It looks like this.

local.properties screenshot

I learned about VIM and how to use it a bit to find out what the ANDROID_HOME environment variable is.

I edited my .bashrc and .bash_profile to look like this using VIM. As far as I understand, these files are located in the user folder. Now they look exactly the same.

export ANDROID_HOME=/Users/Carl/Library/Android/sdk

I can run projects in the emulator in iOS and Android. I can edit js files and make them work the way I want. It seems I can do something in Xcode too. What I can not do is work with Java, trying to create Native Modules for Android, since the projects will not build.

Finally, to be thorough: Android Studio 1.5.1 React-Native 0.18.1 OS X El Capitan

Also, all sdk and build tools are out of order, as far as I can tell.

If anyone has any knowledge on how to fix this Gradle Sync error with Android Studio and React Native, I would really appreciate help! While I can not work with the native modules ...

+4
1

. Android Studio ProjectName/android/, ProjectName/android/app/.

iOS Xcode, , , . . /android/ .

+6

Source: https://habr.com/ru/post/1626452/


All Articles