Facebook released React Native for Android in 2015.9.15, extending JavaScript development technology to the Android platform. React Native allows developers to write applications using JavaScript and
Getting started with React Native Android and in-depth source code analysis series (1) -- Hello world
From today on, I will analyze the source code of React Native for Android.
This series analyzes
React Native Version Upgrade plugin (Android only), react-native version requires 0.17.0 and aboveHow to install 1. Install the NPM package firstNPM Install react-native-upgrade-
It is said that tools make our use more convenient, but recently research react-native packaging and webpack These tools, really a sad tears. It feels like these development tools are very unfriendly to the window system, and foreigners are all using the Mac system's local tyrants.To get to the point, write down this packaging process today, with the aim of helping those kids who work with me in the window
memory consumption acceptable) other is acceptable, Of course on iOS can also use Wkwebview to replace, but because at that time will not expand JS Read Wkwebview page Title property (real-time is not just loaded completed title), so can only use the default WebView.But WebView's problems became prominent on the Android platform, and then there was no way to encapsulate crosswalk Xwalk WebView way to provide and combine:
related settings and add places.Identifies different portal files that are called by 2:react on different platforms.Under normal circumstances, we simply do not need to go through two different portals as long as we do not involve feature codes, components, or plugins that are unique to a particular platform. Otherwise, run the code snippet on Android that may run under Index.ios and copy it to Index.andro
Installation steps
Expo download;
Download Night God simulator, tried to genymotion, but the apk file can not be transmitted;
Open the command line, CD to the night God Simulator directory/bin, check the night God Simulator port (First run night God), with adb connection Shangye God;
Drag the Expo to the simulator to install;
can be run npm run android .
Attention
Appears to Error running adb: No
Stepping on the react Native Android pit for a few days. summed up as a sentence, the current Android learning react native is too early, too many pits, you need to step slowly. At present, can trample the pit basically all tread
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 t
Widows version: Win7 64-bit Professional Edition1. Install the JDK. (I use the JDK7)Note Select x86 or x64 version, add to system PATH environment variable2. Get the Android SDK readyThis is not much to say, it is recommended to use Android Studio, the simulator recommended to use Genymotion, than the own AVD is much faster.3. Installing the C + + environmentYou can install Visual Studio 2013 or 2015 direct
Soloader is a small, open-source project for loading so library files from Facebook , with the primary role of automatically checking and loading multiple dependent so library files. In the Android platform, react-native projects use a large number of dynamic link libraries, the JNI technology, as Java and Javascript Communication bridge between the two program
Like Android, react's components also have a corresponding life cycle. The life cycle of the Android React native component can be summarized in the following diagram as a whole.The component life cycle can be broadly divided into three phases:
The first stage : The first drawing phase of the component, in the
Environment constructionEnvironmental construction can refer to the RN official website, also can refer to the Chinese version: http://reactnative.cn/docs/0.45/getting-started.htmlIf you want to see the original installation process, you can look at the official address, this article is only my personal practice, and is limited to the window platform.Official address: https://facebook.github.io/react-native
(1)Installation: NPM install-g REACT-NATIVE-CLIREACT-NATIVE-CLI is a command-line tool for developing react nativeThe above line of code will help you install the react-native command in terminal. Of course, you only need to run t
1. Login React Native Chinese webHttp://reactnative.cn/docs/0.45/getting-started.html2. Login chocolatey download Package management toolhttps://chocolatey.org/3. Open cmd to copy and paste the command code in Cmd.exe@powershell-noprofile-executionpolicy Bypass-command "IEX (New-object net.webclient). Downloadstring (' Https://chocolatey.org/install.ps1 ')) " SET path=%path%;%allusersprofile%\chocolatey\ Bi
Android uses the package name as the unique ID for the app.Assuming the package name is com.oc.objective, the following needs to be modified.Two Java files
Android/app/src/main/java/com/project_name/mainactivity.java
Android/app/src/main/java/com/project_name/mainapplication.java
修改第一行package com.oc.objective;Description file for
needs to be written for the Gradle script in step four.2. Create Assets FolderCreate the Assets folder under the/android/app/src/main/directory under the project root directory3. Get bundle files and saveFirst: Make sure you use the react-native Start command in the project root to start the packager, and you can use the browser test to get the bundle file corre
/*** Component Drawerlayoutandroid (Implementation of the Android drawer)The Drawerlayoutandroid properties and methods of this article compare the whole point* */Import react,{purecomponent} from ' React 'Import {view,drawerlayoutandroid,text,dimensions,textinput,touchableopacity} from ' React-
1. New Project2. Apply for the Gold Key1. Sign up for the gold developer2. Gold Personal Center Application key3. Fill in the informationNow you need to write SHA1 and PackageName.SHA1 requires a project to be packaged to get to, package the projectGo to java->bin directory keytool-list-v-keystore E:\RN\ShareUmbrella\android\app\xx.keystore---Back to my directoryYou can see the SHA1PackageName into the project And
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.