ViroReact使用 React Native 的 AR 和 VR 平台

联合创作 · 2023-09-26 07:43

Viro React 是一个供开发人员快速构建增强现实 (AR) 和虚拟现实 (VR) 体验的平台。开发人员使用 React Native 进行编写,Viro 在所有移动 VR(包括 Google Daydream、Samsung Gear VR 以及适用于 iOS 和 Android 的 Google Cardboard)和 AR(iOS ARKit 和 Android ARCore)平台上本地运行代码。




手动搭建 ViroReact 平台的说明:


构建 iOS ViroReact:



  1. 按照我们的快速入门指南中的说明设置依赖项。

  2. 使用 git: 将 repo 克隆到工作区git clone https://github.com/viromedia/viro.git

  3. 使用 Virocore 存储库中概述的构建说明构建我们的 iOS 渲染器。

  4. 验证是否看到在ios/dist文件夹中创建的新文件。

  5. ios/文件夹中安装 Pod :

    cd ios pod install 


  6. 在 test 文件夹中安装 node_modules:

    cd test npm install 


  7. ViroExample文件夹中安装 pods :

    cd test/ios/ViroExample pod install 


  8. 在 Xcode 中打开ViroExample.xcworkspace。(确保打开 .xcworkpace 文件,而不是* .xcodeproj 文件)

  9. 选择产品->方案。如果您没有看到React方案,请点击Manage Schemes...。在对话框中添加React方案。

  10. 对 scheme 进行构建配置(Debug 与 Release)。

  11.  

    11.a If you want the ability to run on Simulator, change target to any of the `iOS Simulator` targets instead of `Generic iOS Device`. 11.b If in your own app project setup, you prefer to include Viro React as a static library rather than relying on `use_frameworks!` - build scheme `ViroReact_static_lib` instead of `ViroReact` as mentioned above in step #11. 


  12. 应该会在ios/dist/lib/libViroReact.a中看到libViroReact.a

  13. 要运行 Viro React 测试,请在插入的 iOS 设备上运行ViroExample方案。


构建 Android Viro React:



  1. 在 viro 目录下,运行./prepareRelease.sh.

  2. Android bridge 现在应该是在 release 下构建

  3. 应该会看到在 android/react_viro/react_viro-release.aar 中创建的新文件

  4. 构建 android 发布测试:

    $ cd test/android $ ./gradlew assembleGvrRelease 


  5. 在插入的 Android 设备上从test/android/app/build/output/gvr/app-gvr-release.apk安装 app-gvr-release.apk。

浏览 43
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报