I am trying to start using React-Native for some of my mobile development. Most of it seems very straight forward from the React-Native Docs on Github but I cant get projects to build in Android Studio.
When I try importing the project by navigating to the 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 have retyped deleted and recreated the local.properties file a few times to see if that helped. It didn't. It looks like this.
local.properties screenshot
I learned about VIM and how to use it a little in an effort to figure out what this whole "ANDROID_HOME" environment variable was about.
I edited my .bashrc and .bash_profile to look like this using VIM. These files are in my User Folder as far as I understand. They both look exactly like this now.
export ANDROID_HOME=/Users/Carl/Library/Android/sdk
I can run the projects in the emulator fine in iOS and Android. I can edit js files and get them to work just like I want. I seem to be able to do stuff in Xcode too. What I cant do is work with Java for trying to build Native Modules for Android since projects wont build.
Lastly to be thorough: Android Studio 1.5.1 React-Native 0.18.1 OS X El Capitan
Also the sdk's and build tools are all in line 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 greatly appreciate the help! Until I do I cant work with Native Modules...
This was a learning experience. When opening a project in Android Studio, open at the ProjectName/android/
folder not the ProjectName/android/app/
folder.
If I hadn't spent the last year doing iOS in Xcode this would have likely never happened. Noob mistake. Opening at the /android/
folder fixed all my problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With