I'm trying do the get started react-native tutorial for Ubuntu, I already have installed nodejs, the react-native command line interface, a JDK, and the Android Studio. Already set up the environment variables, so when I try run react-native run-android, this error appears:
info Starting JS server...
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
error Command failed: ./gradlew app:installDebugand I can't find the solution for this.
1 Answer
So what I did was to download this JAR file (gradle-wrapper.jar) and placed it inside android/gradle/wrapper then I went back to the project directory and did:
npm install I then changed directory to android by doing:
cd androidThen I ran the following commands
chmod +x ./gradlew
xattr -l ./gradlewNow i went back to the project directory and ran react-native run-android