Here are the most easily encountered react native Android-related case:
- 1. After the app launches, the Red interface, unable load jsbundle:
- Workaround: Generally speaking, you are using the Dev-serve way, and your server does not match correctly, if you are running with a mobile phone, you need a PC and mobile phone in the same wifi, and through the menu key set Menu-ip for the PC's IP, if it is the simulator, You do not need to manually set the IP, settings, it will be wrong
- 2. After the app is launched, the Red interface, Unregisteredproject
- Prompt for what, your app is not registered at startup
- Solution: This is also a look at the error, is your index.android.bundle in the bottom of the write that
- ' Componetnameinyourlocalproject ' In your Java code is not called this name, check it yourself, can immediately repair
- 3. require ("XXX") component failed
- JS code sometimes appears require ("XXX") component Error Resolution: To detect whether the node component exists on your server, if it is your own encapsulated nativemodule can be used directly
- Solution: You can use the PC-side Chrome Debug tool for JS end debugging, native debugging can only use Logcat tracking, now see most of the errors are their own code problems, reactandroid itself crash less
- Problems with 5.so libraries
- Gradle, the NDK filter can be used to control:
Android {defaultconfig {ndk {abifilters "X86″," armeabi-v7a "}}
- MAVEN, you can manually resolve the problem by using the so copy under Libs.
- This piece has a bigger pit is that the default introduced Jsc.aar in the Armabi folder, but there is no jsc.so. Cause in many places, to encode the source code when the NDK will error.
- 6. About Equipment Minsdkverison
- Default Android requires more than 4.1 devices (4.0 according to the network data about 0.7 ratio, as most apps already do not support under 4.0 devices, this block is also acceptable)
- Just started to use a 5.0 device for Reactandorid testing and development, and then the direction, in fact, make a 5.0+ genymotion simulator, the efficiency will be higher.
- 7.UIExplorer Demo Problem
- have been looking at the specific access and code implementation aspects, when the head of the work back to see, in fact, then should start from this uiexploror, efficiency and progress should be greatly improved.
- This need to compile react source code, if you encounter https://github.com/facebook/react-native/issues/3976 problem, you can use the method I reply below the hook, but the essential reason is the Armabi Jsc.so's Problem
- Based on the team's prior experience with iOS, follow up the skeleton code and rely on the UI components provided by the RN itself to meet most of the business scenarios react.
- Of course, if you want to reuse before the team precipitation, with the Uimanager and uimodule this piece of its own workload to also not too big.
- But should be as far as possible and the team after the JS and iOS end of the protocol interface to maintain consistency, so that react the greatest significance to play out, "lean once run everywhere"
- Prior to 0.14, only DEV-PC and assert were supported, and local file patch loading was supported from the 0.14.0 realease version, with the latest version 0.15.1.
- Because if you want to dynamic capabilities, JS must be on the network side issued, JS itself is clear (even if JS is confused), data protection against hijacking or must do, this can be combined with HTTPS anti-tamper +sign check to do
- Impact of 10.JNI message rotation
- Because of the JNI communication restrictions, the Java layer and the Native communication are unidirectional, and in order to ensure that RN 16ms rendering frequency, all Java-native-jscore layer communication is asynchronous, which may be a performance issue for the Java layer UI rendering.
- When the message volume is very large or the ListView page is very complex, the rendering of each 1-layer cell requires a continuous drawing of the UI thread in the Css-scrowllerview model, and there may be performance problems with the waterfall stream being responsible for the ListView. But the problem itself must be better than the H5 experience.
Ext.: http://codecloud.net/react-native-android-10-problems-6573.html
React native Android most common 10 questions