Skip to content

Instantly share code, notes, and snippets.

@4sskick
Last active February 23, 2024 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 4sskick/9f0a73e5766b2bfbb8242433a740bc37 to your computer and use it in GitHub Desktop.
Save 4sskick/9f0a73e5766b2bfbb8242433a740bc37 to your computer and use it in GitHub Desktop.
run debug version project application react native into emulator and emulate `shake` to emulator device
I got annoying and really have bad experiences to work project using react native (will called as RN) framework. It sluggies and slow!
Just becaue my company is using RN on all their latest mobile project, I do have to force myself to work with it
I got annoyed when it's time to run the project, if follow the resources which spread on internet, you need to hit command `npm/yarn react-native run android`.
I need to wait for a certain time to build and run on emulator. So I've got another method which cutting time to run the project in no time.
- Generate APK of your project on variant DEBUG on Android Studio
- finish, then open the project RN using vscode (or other editor) then do `yarn start` / whatever command to run the RN server
- drag & drop the APK file to emulator to make it automatically install (seems like it only for android Emulator, I have no idea for iOS simulator)
- on first time will run error, don't worry. READ THE ERROR MESSAGE!!
- run command `adb [opt: -s id-emulator] shell input keyevent 82`, it will open the dev menu then choose `Change bundle location`
- input your ip address with port 8081 (ex. 192.168.0.11:8081), hit ok then wait for respond from RN server
- it will direactly load the node modules from your machine
so everytim you wanna run the project just run the RN server & set the Bundle Location. And make sure that your emulator setting > Send keyboard shortcut to: Virtual device
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment