React Native 嵌入到原生应用

嵌入原生遇到的坑

  1.undefined is not an object(ecaluating 'ReactInternals.ReactCurrentOwner')

原因:好像是什么当前版本不存在啥的

解决方法:在根目录下 进入控制台 输入yarn add react@16.0.0-alpha.12

  1. Android studio 报错 tools:overrideLibrary="com.facebook.react"

原因:这个是RN 版本 支持最小 miniSDKVersion = 16 ,我们目前最小指向miniSDKVersion = 15;

解决方法:在Android 目录下的清单文件中添加如下(在Application 标签上) tools:overrideLibrary="com.facebook.react"

3.java.lang.UnsatisfiedLinkError: dlopen failed: "xxx/libgnustl_shared.so" is 32-bit instead of 64-bit

解决方案

1.在项目的根目录的 gradle.properties里面添加一行代码

android.useDeprecatedNdk=true.
2.在project的root目录下的build.gradle中添加如下代码。

defaultConfig { 
    ···
    ndk{ 
        abiFilters "armeabi-v7a","x86" 
    } 
    packagingOptions { 
       exclude "lib/arm64-v8a/librealm-jni.so" 
    } 
}
  1. not fond assert 意思就是找不到资源文件

解决方案:

1. create an assets folder under android/app/src/main
2. curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"

## Thanks:

1.【原】React Native嵌入到现有原生应用

2.嵌入到现有原生应用

3.解决Assets 找不到问题


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值