When you develop your app, use HTML5 to develop some pages that are integrated into iOS and Android to save time and effort. So what are the main libraries that can be used?
This article focuses on three: PhoneGap, Dcloud, Reactnative, and has made an attempt.
Phonegap:http://www.jianshu.com/p/c7fd736437b0
dcloud:http://www.jianshu.com/p/2cdf23c7c043
reactnative:http://www.jianshu.com/p/d63c9a22973d
According to judgment, the current use of reactnative more suitable for our needs.
1. Real-time
The latest version of PhoneGap 2.9.1 is November 2013.
Both Dcloud and Reactnative were recently updated.
2. Friendly
PhoneGap needs to generate a jar package import and does not support MAVEN libraries, inheriting cordovaactivity loading.
publicclass PhoneGapActivity extends CordovaActivity { @Override publicvoidonCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // 更换一下载入形式 //setContentView(R.layout.activity_main); super.loadUrl("file:///android_asset/www/index.html"); }}
Dcloud provides a number of jar packages, more detailed functional partitioning, on-demand import, associated proxies, and resource loading.
if (mEntryProxy == null) { FrameLayout f = (FrameLayout) findViewById(R.id.js_contaner); wm = new WebappMode(this, f); mEntryProxy = EntryProxy.init(this, wm); mEntryProxy.onCreate(savedInstanceState, SDK.IntegratedMode.WEBAPP, wm); }
Reactnative provides a MAVEN library that works with the NPM load module, enabling local services to be loaded with custom controls.
Mreactrootview = (Reactrootview) Findviewbyid (R. ID. Test_JS);Mreactinstancemanager = Reactinstancemanager. Builder(). Setapplication(Getapplication ()). Setbundleassetname("Index.android.bundle"). Setjsmainmodulename("Index.android"). Addpackage(New Mainreactpackage ()). Setusedevelopersupport(Buildconfig. DEBUG). Setinitiallifecyclestate(lifecyclestate. Resumed). Build();Mreactrootview. Startreactapplication(Mreactinstancemanager,"Myawesomeapp", null);
3. Example
PhoneGap is Apache's Open source project Cordova, with more documentation comments and earlier projects.
Dcloud is a domestic HTML5 library, documents are displayed in Chinese, more convenient to learn, demo provides a lot of examples and a variety of usage, learning curve is relatively low.
Reactnative is the public Library of Facebook, the document is all natural, because Android is newer, so until the last week to give the complete document, example is relatively old, difficult to call, according to the document learning how to develop, the current concern a lot.
4. Risks
PhoneGap now seems to be abandoned, or I can't figure out why I didn't update the document.
Dcloud is the domestic development of the library, is still in the iterative stage, the code is more chaotic, the jar package is particularly many, but some of the domestic third-party libraries to support better.
Reactnatvie is a new product of Facebook, and some companies in the country are also using it, so there should be no problem, and after learning, knowledge can be universal, not too small.
Recommended an article about reactnative, written very well!
http://www.zhihu.com/question/27852694
5. Share
PhoneGap's Links
官网: http://phonegap.com/Cordova: http://cordova.apache.org/
Reactnative's Links
官网: http://facebook.github.io/react-native/中文社区: http://reactjs.cn/文档: http://www.w3ctech.com/topic/909?utm_source=tuicool&utm_medium=referral
Dcloud's Links
官网: http://www.dcloud.io/
To sum up, I like reactnative more.
For detailed configuration of Reactnative, refer to:
http://www.jianshu.com/p/7a6639d67783
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Hybridapp Development Library