Start and create a React Native app on your device

What is React Native?

Two ways to develop a React Native app

Using Expo CLI — Fast & Easy

➜  npm -v
6.14.8
➜ node -v
v14.15.1
expo init YourProjectName 
(( select a blank template ))
cd YourProjectNamenpm start

Using React Native CLI

➜  npm -v
6.14.8
➜ node -v
v14.15.1
brew install --cask adoptopenjdk/openjdk/adoptopenjdk8
export ANDROID_HOME=$HOME/Library/Android/sdkexport PATH=$PATH:$ANDROID_HOME/toolsexport PATH=$PATH:$ANDROID_HOME/tools/binexport PATH=$PATH:$ANDROID_HOME/platform-tools
npm install -g react-native-cli
react-native init YourProjectName
adb devices
➜  ~ adb devices
List of devices attached
4T89626CC176362736 device
react-native run-android

Common Errors

Error: Command failed: ./gradlew app:installDebug
sudo react-native run-android
ava.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
repositories {google() <= this line should already existmaven { url "https://maven.google.com" } <= add this linejcenter() <= should exist}
SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable
sdk.dir = /Users/USERNAME/Library/Android/sdk

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store