Skip to content

nghinv-software/react-native-command

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

React Native Command

Clear cache

  • Clear cache android
cd android && ./gradlew clean && cd ..
  • Clear cache npm
npm cache clean --force

Run app

  • Run node service

    • Use npm:
    npm run start
    • Use yarn:
    yarn start
    • Run with reset cache:
    yarn start --reset-cache
  • Run app android

react-native run-android
  • Run app ios
react-native run-ios
  • Run app ios with simulator
react-native run-ios --simulator="iPhone 11 Pro Max"
  • To show list simulator run command
xcrun simctl list devices

Logs

  • Show log native android
adb logcat
  • Show log native android
adb logcat --pid=`adb shell pidof -s com.yourpackage`

Build app

  • Build app android release
cd android && ./gradlew assembleRelease && cd .. 
  • Build app android bundle release
cd android && ./gradlew bundleRelease && cd .. 
  • Build app android release debug

    • Step 1 run command
    react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res
    • Step 2 run
    cd android && ./gradlew assembleDebug && cd ..

Simulator

  • Open emulator android

    • Show list emulator android
    emulator -list-avds
    • Open emulator
    /Users/YourComputerName/Library/Android/sdk/emulator/emulator -avd EmulatorName -netdelay none -netspeed full

    YourComputerName: Your computer name (Ex: MyComputer)

    EmulatorName: Emulator name (Ex: Pixel_3a_API_30_x86)

NPM

Login

  • Login normal
npm login
  • Login with scope
npm login —scope=@[scope]

Profile

  • Create profile
npm init —scope=@[scope]
  • Switch scope
npmrc [profile-name]

Publish

  • Publish
npm publish --access public
  • Unpublish
npm unpublish -f @[scope]/[package-name]n@[version]

(-f --> force)

Github

Tag

  • Create Tag
git tag v1.0.0
  • Pushing a Tag
git push origin v1.0.0

Keystore & keychain

  • Create keystore
keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
  • Create SHA-1 certificate fingerprints
keytool -list -v -keystore PathToYourApp/android/app/my-release-key.keystore -alias my-key-alias -storepass mystorepass -keypass mykeypass
  • Copy ssh key
pbcopy < ~/.ssh/id_rsa.pub

Deeplink

Open app android

adb shell am start -a android.intent.action.VIEW -d "your-deep-link” app-package-name

Some error with react native

  1. Error verifyReleaseResources
// add to bottom of file android/build.gradle
subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                buildToolsVersion rootProject.ext.buildToolsVersion
            }
        }
    }
}
  1. Error can't call api with http on android
// add to application tag of AndroidManifest.xml file
android:usesCleartextTraffic="true"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published