这是在我们将compileSdkVersion和targetSdkVersion升级到31之后开始发生的。
给予一些背景:我们的项目目前使用的是react native 0.63.2,之前的compileSdkVersion是30。我们在几天前成功构建了Android应用程序,但突然它开始失败,并出现以下错误:
AAPT: error: resource android:attr/lStar not found
在网上搜索了一下之后,我们在这里找到了一些解决方案:资源链接在lStar上失败。我们升级到了compileSdkVersion,targetSdkVersion升级到了31,做了一些其他相关的更改,并且能够成功编译。但是当我在Android 13设备上运行应用时,应用在启动时立即崩溃。以下是来自logcat的错误日志:
2022-11-06 16:54:44.438 15842-15842/com.flyfinapp E/SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found: needed by /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64/libjscexecutor.so in namespace classloader-namespace result: 0
2022-11-06 16:54:44.480 15842-15842/com.flyfinapp E/SoLoader: couldn't find DSO to load: libhermes-executor-debug.so caused by: dlopen failed: cannot locate symbol "_ZTVN6hermes2vm12CrashManagerE" referenced by "/data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64/libhermes-executor-debug.so"... result: 0
2022-11-06 16:54:44.482 15842-15842/com.flyfinapp E/SoLoader: couldn't find DSO to load: libhermes-executor-release.so
SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.flyfinapp/lib-main flags = 1]
SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64 flags = 0]
SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
Native lib dir: /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64
result: 0
2022-11-06 16:54:44.483 15842-15842/com.flyfinapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.flyfinapp, PID: 15842
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-release.so
SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.flyfinapp/lib-main flags = 1]
SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64 flags = 0]
SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
Native lib dir: /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64
result: 0
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1127)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:943)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:855)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:802)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:772)
at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:30)
at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:19)
at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:23)
at com.facebook.react.ReactInstanceManagerBuilder.getDefaultJSExecutorFactory(ReactInstanceManagerBuilder.java:369)
at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:316)
at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:94)
at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:41)
at com.flyfinapp.MainApplication.onCreate(MainApplication.java:77)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1266)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6785)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2134)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
2022-11-06 16:54:44.483 15842-15842/com.flyfinapp E/WebEngage: App has crashed
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-release.so
SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.flyfinapp/lib-main flags = 1]
SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64 flags = 0]
SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
Native lib dir: /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64
result: 0
2022-11-06 16:54:47.669 15942-15942/com.flyfinapp E/SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found: needed by /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64/libjscexecutor.so in namespace classloader-namespace result: 0
2022-11-06 16:54:47.676 15942-15942/com.flyfinapp E/SoLoader: couldn't find DSO to load: libhermes-executor-debug.so caused by: dlopen failed: cannot locate symbol "_ZTVN6hermes2vm12CrashManagerE" referenced by "/data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64/libhermes-executor-debug.so"... result: 0
2022-11-06 16:54:47.678 15942-15942/com.flyfinapp E/SoLoader: couldn't find DSO to load: libhermes-executor-release.so
SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.flyfinapp/lib-main flags = 1]
SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64 flags = 0]
SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
Native lib dir: /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64
result: 0
2022-11-06 16:54:47.679 15942-15942/com.flyfinapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.flyfinapp, PID: 15942
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-release.so
SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.flyfinapp/lib-main flags = 1]
SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64 flags = 0]
SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
Native lib dir: /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64
result: 0
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1127)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:943)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:855)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:802)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:772)
at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:30)
at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:19)
at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:23)
at com.facebook.react.ReactInstanceManagerBuilder.getDefaultJSExecutorFactory(ReactInstanceManagerBuilder.java:369)
at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:316)
at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:94)
at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:41)
at com.flyfinapp.MainApplication.onCreate(MainApplication.java:77)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1266)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6785)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2134)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
2022-11-06 16:54:47.679 15942-15942/com.flyfinapp E/WebEngage: App has crashed
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-release.so
SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.flyfinapp/lib-main flags = 1]
SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64 flags = 0]
SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
Native lib dir: /data/app/~~xPxviTwL84s3LS8L8OTgAA==/com.flyfinapp-EZ0vekCsB5BzvVwFLbm-GQ==/lib/arm64
result: 0
我们已经将enableHermes
设置为true。我们也搜索了这个问题的解决方案,但是所有的解决方案都适用于RN 67和更高版本。但是我们仍然在RN 63上,所以这些解决方案都不起作用。我们可以尝试升级我们的RN版本,但是有一些阻止程序,所以不可能马上升级。现在我们想解决这个具体的问题,然后继续前进。任何帮助都将不胜感激。
4条答案
按热度按时间bhmjp9jg1#
如果您不使用react原生库,我建议您使用react原生库的固定稳定版本,如下所示:
或者,您可以考虑使用
package.json
文件中REACT_NATIVE_VERSION
的动态值和以下脚本:这将防止您的应用程序由于不稳定的版本而出现意外行为,但是,缺点是您必须从react原生库手动检查最新更新,并不时更新。
8tntrjer2#
唯一对我有效的是在app/build.gradle中禁用爱马仕
8oomwypt3#
它似乎与Maven上的一个中断版本有关。
下面是关于它的对话:https://github.com/facebook/react-native/issues/35210
@Ankur的评论是RN〉= 0.63的建议变通方案
sgtfey8w4#
通过在build.gradle中为
hermesFlagsForVariant
和deleteDebugFilesForVariant
设置适当的值,我能够解决完全相同的问题。确保您指定的值与您的构建变体名称匹配(例如beta
、qa
等)https://github.com/facebook/react-native/issues/33177#issuecomment-1066604107。但是,我使用的是RN0.70.5,所以不确定它在旧版本中是否有帮助