嵌入原生遇到的坑
1.
undefined is not an object(ecaluating 'ReactInternals.ReactCurrentOwner')
原因:好像是什麼當前版本不存在啥的
解決方法:在根目錄下 進入控制檯 輸入yarn add [email protected]
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"
}
}
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: