React Native: Useful command lines

Clear cache

watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf /tmp/haste-map-react-native-packager-* && rm -rf node_modules/ && yarn cache clean && yarn install && yarn --reset-cache

Clean Android gradle

SDK location not found

Create “local.properties” file

cd android
vim local.properties
sdk.dir=/Users/*****/Library/Android/sdk

Rebuild Android dependencies

cd android
./gradlew clean

Clean iOS pod

cd ios
rm -rf Podfile.lock
pod install

react-devtools

react-devtools

pod install

pod update && pod cache clean --all && pod install

Test deep link on iOS simulator

xcrun simctl openurl booted "deeplink_url"

Debug on real Android device

Install adb

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew cask install android-platform-tools

Debug

adb devices
adb -s <device name> reverse tcp:8081 tcp:8081
yarn android

Android – Keystore file not found for signing config ‘debug’.

cd android/app/
keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000

Bundle commands

Release

react-native bundle --minify --entry-file index.js --platform ios --dev false --bundle-output main.jsbundle

Debug

react-native bundle --minify --entry-file index.js --platform ios --dev true --bundle-output main.jsbundle

Be the first to comment

Leave a Reply

Your email address will not be published.


*