I'm trying to do the Android tutorial for React Native, but I'm hitting a wall. All of the requirements for React Native to work are good to go, and I've followed the Android Setup instructions.
I do not have a .bashrc, so I made one and put export ANDROID_HOME=/usr/local/opt/android-sdk
in there, but realized when I did echo $ANDROID_HOME
, I got nothing in return. I also don't have a .profile, so I added it to my bash_profile, and it now returns the path with echo.
I have installed
- Android SDK Build-tools version 23.0.1
- Android 6.0 (API 23)
- Android Support Repository
as well as
- Intel x86 Atom System Image (for Android 5.1.1 - API 22)
- Intel x86 Emulator Accelerator (HAXM installer)
I installed the Intel HAXM kernel extension and created an AVD using the same parameters shown in the setup instructions.
I then started the emulator for the device I created, opened a new tab in the terminal and ran react-native run-android
, and that's when I hit the error.
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Could not install the app on the device, see the error above.
I have created two different React Native projects with just the skeleton, and I get the error with both, which is making me believe I'm doing something wrong. Has anyone else run into this error or have any idea what might be going on?
Note: It runs fine iOS-wise with XCode
Update:
So someone else sent me a new React Native project that they created on their machine. I downloaded and unzipped it in my Downloads folder. After opening it, I npm install
ed. I then started the emulator and ran react-native run-android
. It worked. So I tried the same thing with the same file in the folder that it should be in. And then I got the error. So it seems that it might have something to do with my environment? In both of these folders, node and npm versions are the same (node v4.1.0 and npm 2.14.5).