Last active
April 28, 2020 07:14
-
-
Save swalahamani/8b0f95c8a56652f46e57d093950fe9f7 to your computer and use it in GitHub Desktop.
A set of react native (mostly android) helper commands. A CLI tool with dynamic project support is on the way. Keep an eye on https://github.com/swalahamani/react-native-assistant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################## | |
# react-native helper commands BEG | |
export ANDROID_APP_BUNDLE=com.example.appname | |
export ANDROID_DEV_DEVICE_IP=192.168.1.52 # your android device ip | |
export ANDROID_DEV_DEVICE_PORT=8978 # your android device debug port | |
export ANDROID_DEV_DEBUG_APK_PATH=./android/app/build/outputs/apk/debug/app-debug.apk | |
export ANDROID_DEV_RELEASE_APK_PATH=./android/app/build/outputs/apk/release/app-release.apk | |
#to simplify react-native cli usage | |
alias react-native="npx react-native" | |
#to start tcpip server on device | |
alias adbtcpip="adb tcpip $ANDROID_DEV_DEVICE_PORT" | |
#to connect android device with ip(192.168.225.31) on port 5555 | |
alias adbconnect="adb connect $ANDROID_DEV_DEVICE_IP:$ANDROID_DEV_DEVICE_PORT" | |
#to get react-native settings in dev/app | |
alias appsettings="adb shell input keyevent 82" | |
#to reload app in dev | |
alias appr="adb shell input text \"RR\"" | |
#reconnect metro server with device | |
alias rnreconnect="adb reverse tcp:8081 tcp:8081" | |
#clean react native android app | |
alias grdclean="cd android && ./gradlew clean && cd .." | |
#clear app data of android_app | |
alias appclear="adb shell pm clear $ANDROID_APP_BUNDLE" | |
#building rn app for android | |
alias rnbuild="react-native run-android --port" | |
#build rn android release signed apk | |
alias buildsgrsapk="cd android && ./gradlew assembleRelease" | |
# building rn unsigned app with debug mode without bundle server | |
alias builddebugapk="react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res && cd android && ./gradlew assembleDebug" | |
#install release-apk./!\ Must be in app root directory. | |
alias appinstall="adb install $ANDROID_DEV_RELEASE_APK_PATH" | |
#install debug-apk. | |
alias appdinstall="adb install $ANDROID_DEV_DEBUG_APK_PATH" | |
#uninstall android_app app from android tab | |
alias appuninstall="adb uninstall $ANDROID_APP_BUNDLE" | |
#launch android_app app from android device | |
alias applaunch="adb shell am start -n $ANDROID_APP_BUNDLE/$ANDROID_APP_BUNDLE.MainActivity" | |
#stop android_app app running on th eandroid device | |
alias appstop="adb shell am force-stop $ANDROID_APP_BUNDLE" | |
# react-native helper commands END | |
############################################################################## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment