Skip to content

Latest commit

 

History

History
92 lines (64 loc) · 5.61 KB

dev.md

File metadata and controls

92 lines (64 loc) · 5.61 KB

Environmental Preparation

  • operating system:
    • MacOS 10.15.7 or above
  • Tools collection:
    • Xcode 13.4 or above (if developing iOS platform reference)
    • Android studio 2021.3.1 or above (if developing Android platform applications) (as for short)
    • Visual Studio Code latest (vscode for short)
  • Compile and run environment:
    • Java JDK 1.8.0 or above (it is recommended to use Android studio's own)
    • Objective-C 2.0 or above (recommended to use Xcode comes with it)
    • Typescript 4.0 or above
    • Nodejs 16.18.0 or above (brew installation is recommended)
    • yarn 1.22.19 or above (brew installation is recommended)
    • React-Native 0.63.5 or above
    • npm and related tools (not recommended, please solve related problems by yourself)
    • expo 6.0.0 or above

Compile and Run

Project Initialization

  1. Use vscode to open the project react-native-chat-library
  2. Use terminal to initialize the project yarn
  3. If it is the first project initialization, you also need to execute the command yarn run generate-source-env to generate the corresponding files. For example: env.ts.

Note yarn will execute additional commands. For developers who don’t understand commands, if they need to use npm command instead, they need to understand more trustworthy content. Note When creating this project, the scaffolding has preset some yarn related commands, so it is recommended to use yarn to complete most of the work. Note Because example uses firebase cloud message (fcm) related content, if users need to use related content, they need to set the corresponding file (GoogleService-Info.plist is required for iOS platform, google-services is required for Android platform .json), if you don’t need it, just delete the relevant content.

Universal Compilation

The operation steps are as follows:

  1. Use terminal to change directory to example
  2. Execute the command yarn run iOS to compile and run the iOS application
  3. Execute the command yarn run Android to compile and run the Android application

NOTE This mode is deprecated for compilation. Modify Command Please refer to example/package.json related content. Reference For more information on compiling and running commands, please refer to expo related content.

Universal Operation

Running an application in development mode requires additional local services, which can dynamically detect file source code modifications and perform dynamic debugging.

  1. Using the terminal tool, switch to cd example/iOS
  2. Using the terminal tool, execute the yarn run start command to start the service.

iOS Platform

compile and build the project

In the compilation phase, the iOS platform needs to execute the pod install command to generate the Xcode xcworkspace project file.

  1. Using the terminal tool, switch to cd example/iOS
  2. Use the terminal tool to execute pod install to generate example/iOS/example.xcworkspace.
  3. Use the Xcode tool to open the project file example/iOS/example.xcworkspace
  4. If you use the simulator, you need to choose iOS 12.4 or below
  5. If you use a real device, the developer mode needs to be enabled on the real device, and singing & capabilities related content needs to be set in the project
  6. Use the Xcode tool to execute the compile operation.

Note For developers who do not use Xcode to compile, they can use the official recommended method to compile. If there is a problem, it is generally difficult to find the cause of the problem. Note The react-native native service is automatically started, not the expo service, and an error will be reported. Just turn off the service.

run the project

Use the command provided by the expo tool to start the local service, refer to the General Operation chapter.

Note If the running application is not loaded correctly, you need to refresh the page, or close the application and restart it. For error reporting problems, you can generally solve them through corresponding prompts.

Android Platform

compile and build the project

During the compilation phase, the Android platform needs to execute the sync initialization project.

  1. Start the Android studio (referred to as as) tool, open the project file example/Android,
  2. Click the sync project with gradle files button to execute the initialization operation,
  3. If using an emulator, please select or create an emulator of version 6.0 or above,
  4. If it is a real device, you need to enable the developer mode of the device,
  5. When sync is successful, click the run app button to compile and run the project.

Note If you use as for the first time, it may take a lot of downloading and the waiting time will be longer. Note Android platform devices need data forwarding. The command for data forwarding is adb reverse tcp:8081 tcp:8081. Since exampleuses theexpo` tool, it does it for you, so no manual work is required.

run the project

Use the command provided by the expo tool to start the local service, refer to the General Operation chapter.

Note If the running application is not loaded correctly, you need to refresh the page, or close the application and restart it. For error reporting problems, you can generally solve them through corresponding prompts. Note Android platform devices need data forwarding. The command for data forwarding is adb reverse tcp:8081 tcp:8081. Since exampleuses theexpo` tool, it does it for you, so no manual work is required.