React Native with Android

React Native — Build a development environment

React Native works with Android (part 3) — Integrate it into Android projects

React Native implementation (4) — Code integration

React Native with Android

Q&A

Libgnustl_shared. so” is 32-bit instead of 64-bit

android {
    defaultConfig {
        ndk {
            abiFilters "armeabi-v7a"."x86"
        }
        packagingOptions {
            exclude "lib/arm64-v8a/librealm-jni.so"}}}Copy the code
React-native run-Android Android project not found

If appear Could not get BatchedBridge, make sure your bundle is packaged correctly

Could not connect to development Server

http://localhost:8081/index.android.bundle?platform=android

3. Flight mode closed

Adb reverse TCP :8081 TCP :8081

Make sure your bundle is packaged correctly or your’re running a packager server

The index.android.bundle is a javascript script that calls native controls. Every time the index.android.js is changed, the above code snippet is used to update the index.android.bundle. The react-native project will not run without the index.android.bundle file.

The solution is

Step 1: Create an empty assets folder in the Android/app/ SRC /main directory (ignore if it already exists)

The index.android.bundle is a javascript script that calls native controls. Every time the index.android.js is changed, the above code snippet is used to update the index.android.bundle. The react-native project will not run without the index.android.bundle file.

The solution is

Step 1: Create an empty assets folder in Android/app/ SRC /main (ignore if it already exists)

Step 2: In Android Studio Terminal, enter the project root directory and execute the following code:

react-native bundle –platform android –dev false –entry-file index.android.js –bundle-output app/src/main/assets/index.android.bundle –assets-dest app/src/main/res/

After the operation is complete, you can see the following indicating that it is successful

React Native’s developer mode

Write in the last

According to my personal experience of developing APP with React Native, React Native is suitable for C/S structure, business type APP or its modules. I have not tried RN to use tool class APP (or module) that focuses on the underlying technology. But surely not very suitable. In general, a dependence on the underlying technology is not much, YeWuXing, especially business change frequent application or module for RN development, and development, basic can fully reused for two platforms, important is to deal with hot update business logic frequently updated, updated requirements quickly and quickly repair online bug demand scenarios, now see, RN’s hot updates have not been blocked by Apple. 1. No need to compile. After I compiled IPA for the first time and installed it, I never updated the APP again. 2. Most of the layout codes are JSX, and all Native components are tabulated, which reduces a lot of learning costs and greatly reduces the amount of code for front-end programmers. Take a look at JSX compiled code. 3. Reusing the React system also reduces learning and development costs. More importantly, it makes use of the layered and diff mechanisms in React. The JS layer passes a DIff json to the Native layer, and then Native maps this data into a real layout view. 4. Css-layout is also a nice touch. You can use a familiar CSS style to compose a layout. 5. The system has only one-way jS-objC calls, which map native UI component methods to JS via javascritcore or WebView (earlier versions of iOS). The whole call process is asynchronous, which allows React Native js to run in desktop Chrome. Connecting Native code to desktop Chrome via Websocket makes debugging much easier. Bang wrote a detailed article about the mechanics, which I won’t rehash: 6. Tapping is also abstracted into a set of components (TouchableXXX) in a way THAT I didn’t expect when I did similar work earlier. Facebook also lists the reasons why Native feels different from the Web: React Native provides real-time click-feedback and cancellation capabilities. The React Native mechanism is designed to control all click-action processes like Native Code does. CMD + D opens a Chrome window, and all js files are moved to Chrome to run, so there is no need to step on the stack.

The above are both features and advantages, and the following are the disadvantages, or should I say, “remaining issues”, which, in my opinion, surpass the Hybird scheme. 1. Systems still (have to) rely on components and methods exposed by native components. Two examples, the ScrollView the component, in Native layer is of a large number of events, scrollViewWillBeginDragging, scrollViewWillEndDragging, scrollViewDidEndDragging, etc. None of these events are exposed in the current version, and the component linkage effect is basically impossible. In addition, there are a number of components in this release that are iOS only: ActivityIndicatorIOS, DatePickerIOS, NavigatorIOS, PickerIOS, SliderIOS, SwitchIOS, TabBarIOS, AlertIOS, AppStateIOS, LinkingIOS, PushNotificationIOS, StatusBarIOS, VibrationIOS, and conversely, the rest are basic components that are extremely abstract. As a result, users have to write two sets of code on different platforms, and all capabilities still rely heavily on the interface exposed by the React Native developers. 2. Because React is the outermost layer, the initial learning cost is high. Unlike the usual Hybird solution, you only need to learn a few JS APIS to start working. React does make subsequent development a little easier. A set of exotic (ios-based), broken CSS-layouts doesn’t look so ugly when packaged with React. Also, React Native is still far from perfect. The documentation is not complete, I basically watched the demo completed by his sample code, and the documentation integrated into the existing app came out today. Officially, the Android version released until after six months: Blog | React, when designing the whole system may also have a big change. # # # # # # reference www.zhihu.com/question/27… Github.com/reactnative… www.lcode.org/category/re…