Hippy跨端开发框架-初探

Hippy跨端开发框架-初探

前言

Hippy是腾讯最近开源的一款跨平台的前端框架,一套代码即可运行与android、ios、和web!和weex、rn一样,不过腾讯这个Hippy而腾讯的 Hippy 框架,也是在上层兼容了 RN 的API。这意味着,如果你用 Hippy 构建了应用,又想要切回 RN 的时候,业务层的工作量是非常小的,几乎0成本。

开始

  1. clone https://github.com/Tencent/Hippy.git 到webstorm或者vs中。
  2. 安装前端依赖,运行命令:npm install
  3. 编译前端 SDK 包,运行命令: npm run build
  4. 选择一个前端范例项目来进行编译:npm run buildexample -- [hippy-react-demo|hippy-vue-demo]

运行

启动 Xcode或者As并且导入根目录下的examples/ios-demo项目或者examples/android-demo项目,然后运行项目。

坑点

这里要说的是假如你的As版本在3.0以上,在安卓上运行可能会出现意想不到的问题,
比如:No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
或者 extensionSupplier.get()!!.compileSdkVersion must not be null
再或者 CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool. CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
解决方案请参考:https://github.com/Tencent/Hippy/issues/16

开发

对于web前端同学来说,npm run serve可以运行web版本,运行npm run hippy:vendornpm run hippy:build可以生成native端的包,复制这个包到你android或者ios项目中的asset即可!

#
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×