将我的应用程序更新到react-native v0.66.0后,如果启用了hermes,我会不断收到此错误。我尝试删除 DerivedData 文件夹、podfile podfile.lock...但没有任何帮助
终端输出
duplicate symbol 'folly::exception_wrapper::from_exception_ptr(std::exception_ptr&&)' in:
/Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
/Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::from_exception_ptr(std::exception_ptr const&)' in:
/Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
/Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::onNoExceptionError(char const*)' in:
/Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
/Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exceptionStr(folly::exception_wrapper const&)' in:
/Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
/Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::uninit_' in:
/Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
/Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::ExceptionPtr::ops_' in:
/Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
/Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::SharedPtr::ops_' in:
/Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
/Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
ld: 7 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)
ios/podfile
platform :ios, '11.0'
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' …Run Code Online (Sandbox Code Playgroud) 我创建了一个新的 React Native 项目,然后安装 npm ,运行命令 bundle install ,然后 cd iOS pod install 但它卡住了
Installing React-perflogger (0.71.2)
Installing React-runtimeexecutor (0.71.2)
Installing ReactCommon (0.71.2)
Installing SocketRocket (0.6.0)
Installing TOCropViewController (2.6.1)
Installing Yoga (1.14.0)
Installing YogaKit (1.18.1)
Installing boost (1.76.0)
Installing fmt (6.2.1)
Installing glog (0.3.5)
Installing hermes-engine (0.71.2)
Run Code Online (Sandbox Code Playgroud)
这是我的 package.json 文件
{
"name": "ApproverApp",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^1.16.1",
"@react-navigation/bottom-tabs": "^6.2.0", …Run Code Online (Sandbox Code Playgroud) 我已经在我的react-native(v0.64)应用程序中启用了Hermes。每次我运行应用程序时,我都会得到以下堆栈跟踪。
dyld: dyld cache load error: shared cache file open() failed
dyld: Library not loaded: @rpath/hermes.framework/hermes
Referenced from: /Users/sharktank/Library/Developer/CoreSimulator/Devices/A32F4931-51A8-4D22-AEFB-625F834CE221/data/Containers/Bundle/Application/71773888-08D5-4B82-9545-07F6B1538864/COSPM-DEV.app/COSPM-DEV
Reason: image not found
dyld: launch, loading dependent libraries
DYLD_SHARED_CACHE_DIR=/Users/sharktank/Library/Developer/CoreSimulator/Caches/dyld/20E232/com.apple.CoreSimulator.SimRuntime.iOS-14-4.18D46
DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
DYLD_LIBRARY_PATH=/Users/sharktank/Library/Developer/Xcode/DerivedData/COSPM-atbujvbobdbyehckyoqrdgmqiubm/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSim
(lldb)
Run Code Online (Sandbox Code Playgroud)
我已经在 Podfile 中启用了 Hermes,在 pod install 后,Pods 文件夹中可以使用 pod。项目与其他项目一起采用单一存储库架构。在同一个 mono-repo 包中启用 Hermes 的另一个应用程序工作正常,没有崩溃。
播客文件:
require_relative '../../../node_modules/react-native/scripts/react_native_pods'
require_relative '../../../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'COSPM' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods …Run Code Online (Sandbox Code Playgroud) 脚蹼Hermes debugger不显示
请问如何让他正常显示\xef\xbc\x9f
\n\nreact-native\xef\xbc\x9a0.62.2(从0.61更新到0.62.2)
\n\n\n\nhttps://reactnative.dev/docs/hermes
\n\n错误信息:
\n\nMetro is connected but no Hermes apps were found.\n\nOpen a React Native screen with Hermes enabled to connect. Note: you may need to reload the app in order to reconnect the device to Metro.\nRun Code Online (Sandbox Code Playgroud)\n\n\n\n\n flipper react-native react-devtools react-native-hermes fbflipper
我正在尝试Hermes在新项目中启用,但尽管我已启用它,android/app/build.gradle但未启用。Engine: Hermes如文档中所述,我无法在应用程序中看到文本。我正在使用WebStorm 2019.2项目模板。
应用程序.js:
// imports
const App = () => {
return (
<Fragment>
<StatusBar barStyle="dark-content"/>
<SafeAreaView>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={styles.scrollView}>
<Header/>
{global.HermesInternal == null ? null : (
<View style={styles.engine}>
<Text style={styles.footer}>Engine: Hermes</Text>
</View>
)}
// rest of the default ui omitted
</ScrollView>
</SafeAreaView>
</Fragment>
);
};
export default App;
Run Code Online (Sandbox Code Playgroud)
babel.cofig.js:
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
};
Run Code Online (Sandbox Code Playgroud)
地铁.config.js:
module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: …Run Code Online (Sandbox Code Playgroud) 我使用 react-native 0.61.2 创建了我的应用程序的发布版本并启用了 Hermes。在我的 Crashlytics 中,我收到有关崩溃的信息以及堆栈跟踪。以前我曾经应用 apktool 从我的 apk 中提取 index.android.bundle,它包含我能够通过堆栈跟踪找到问题的 js 代码。
但是现在使用 Hermes index.android.bundle 似乎包含字节码而不是 js,我浪费了一天试图反汇编它。我尝试的最后一件事是https://github.com/facebook/hermes/blob/master/doc/BuildingAndRunning.md 中提到的hbcdump工具,但我得到的只是“错误:无法反序列化字节码:错误的字节码版本。预期73 但得到了 62"
我应该怎么做才能反汇编用 Hermes 创建的 index.android.bundle?任何帮助表示高度赞赏!
android disassembly android-bundle react-native react-native-hermes
我正在开发一个反应本机项目,该项目最初使用旧的反应本机版本。更新项目以使用最新的react-native版本,在其他方面都非常成功。但是,我无法为 Android 启用 Hermes 引擎。
我已按照此处的官方步骤操作:Using Hermes。为了确认 Hermes 是否已启用,我清理并重建了 android 项目,在调试模式下运行应用程序并使用以下代码:
const isHermes = () => !!global.HermesInternal;
console.log(isHermes());
Run Code Online (Sandbox Code Playgroud)
Flipper v0.80.0 也找不到 Hermes 应用程序。
android/build.gradle
buildscript {
ext {
buildToolsVersion = "29.0.3"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
ndkVersion = "20.1.5948944"
supportLibVersion = "29.0.0"
googlePlayServicesVersion = "+"
firebaseVersion = "+"
ext.kotlinVersion = '1.3.10'
}
repositories {
google()
jcenter()
}
dependencies {
classpath('com.android.tools.build:gradle:4.1.0')
classpath "com.google.gms:google-services:4.3.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
allprojects {
repositories {
mavenLocal()
maven {
url("$rootDir/../node_modules/react-native/android") …Run Code Online (Sandbox Code Playgroud) 我正在构建一个React-Native应用程序,一切正常,直到我决定从版本 0.59.x 升级到v 0.61.5。
当我尝试在 Play 商店中发布我的应用程序时,Firebase Crashlytics ( v 6.2.0 )报告了很多崩溃——尽管我的版本仅用于内部测试,所以它必须是一个预由 playstore 触发的启动报告- 对于完全相同的设备 => LGE Nexus 5X with android 6.0.1完全相同。
Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
at com.facebook.soloader.SoLoader.assertInitialized(SoLoader.java)
at com.facebook.soloader.SoLoader.assertInitialized(SoLoader.java)
at com.facebook.soloader.SoLoader.assertInitialized(SoLoader.java)
at com.facebook.soloader.SoLoader.assertInitialized(SoLoader.java)
at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java)
at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java)
at java.lang.Thread.run(Thread.java:818)
Run Code Online (Sandbox Code Playgroud)
为了解决这个问题,我尝试提交多个具有略微不同 android 配置的版本(例如启用和不启用 hermes),但它不会改变最终结果。
这是我的build.gradle文件:
apply plugin: "com.android.application"
apply plugin: "io.fabric"
import com.android.build.OutputFile
/**
* The react.gradle file registers …Run Code Online (Sandbox Code Playgroud) android firebase crashlytics react-native react-native-hermes
我按照官方文档在我的应用程序中启用 Hermes 引擎,但以下内容始终返回 false:
const isHermes = () => !!global.HermesInternal;
console.log('>>>>>>>>>>>>>', isHermes());
Run Code Online (Sandbox Code Playgroud)
我所做的更改是在 android/app/build.gradle 中设置以下内容:
project.ext.react = [
enableHermes: true, // clean and rebuild if changing
]
Run Code Online (Sandbox Code Playgroud)
然后我做了一个干净的构建:
cd android && ./gradlew clean
yarn android
Run Code Online (Sandbox Code Playgroud)
但console.log总是返回false
每当我的代码在本地使用 Hermes 运行 expo 时出现错误,我也会收到以下错误消息:
Error: ENOENT: no such file or directory, open 'C:\Users\kudo\01_Work\Repos\expo\expo\android\versioned-react-native\ReactAndroid\hermes-engine\.cxx\MinSizeRel\6d3b5k69\x86\lib\InternalBytecode\InternalBytecode.js'
现在,如果我修复代码错误,例如缺少括号,上述错误也会消失并且一切正常。但是,无论我的代码中存在什么错误,都会出现此错误,并且它相当冗长并且阻止我进行调试。如果我删除 Hermes,错误也会消失,但我想使用 Hermes。
这是我的环境信息:
expo-env-info 1.0.5 environment info:
System:
OS: Windows 10 10.0.19044
Binaries:
Node: 16.16.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 9.1.1 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: AI-212.5712.43.2112.8609683
npmPackages:
expo: ^46.0.0 => 46.0.15
react: 18.0.0 => 18.0.0
react-dom: 18.0.0 => 18.0.0
react-native: 0.69.6 => 0.69.6
react-native-web: ~0.18.7 => 0.18.9
Expo Workflow: managed
Run Code Online (Sandbox Code Playgroud)
我尝试过的事情:
rm -rf node_modulesnpm cache clean --force npx …react-native ×10
android ×4
flipper ×2
xcode ×2
build.gradle ×1
cocoapods ×1
crashlytics ×1
disassembly ×1
expo ×1
fbflipper ×1
firebase ×1
ios ×1
pod-install ×1
webstorm ×1