Saturday 16 July 2022

Android - React native quick cheat sheet

1) check version of any package : 

npm view @react-native-community/netinfo version

2) uninstall any package:

npm uninstall @react-native-community/netinfo

3) install any package:

npm install @react-native-community/netinfo

4) install specific version of package:

npm install @react-native-community/netinfo@6.0.0

5) install latest version of package:

npm install @react-native-community/netinfo@latest

6) --save flag to that command to add it to your package.json dependencies 

7) JDK download and installation : https://jdk.java.net/archive/

- after downloading zip file unzip and keep it in any folder example : C:\Program Files\jdk-11.0.2\

- set top level path as JAVA_HOME system variable : C:\Program Files\jdk-11.0.2\

- add path variable for java binaries : C:\Program Files\jdk-11.0.2\bin\

- open cmd and type : java -version and check version.

https://stackoverflow.com/questions/68344424/unrecognized-attribute-name-module-class-com-sun-tools-javac-util-sharednametab

8) Check JAVA_HOME : echo %JAVA_HOME%

9) Clear cache :

React native : react-native start --reset-cache

npm : npm start -- --reset-cache

https://stackoverflow.com/questions/46878638/how-to-clear-react-native-cache

10) Note : if you using vs code you might need to restart vs code to get updated path varibales.

11) If some process keep getting stuck clear cache and try to restart the PC.

12) watchman watch-del <Project-Path>

13) gradlew build -Phttp.socketTimeout=60000 -Phttp.connectionTimeout=60000

https://stackoverflow.com/questions/37156568/increase-timeout-for-gradle-to-get-a-maven-dependency

14) use implementation instead of compile :
https://stackoverflow.com/questions/44493378/whats-the-difference-between-implementation-api-and-compile-in-gradle







No comments:

Post a Comment