Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnsatisfiedLinkError issue on first build (React Native v0.69) #148

Closed
jhen0409 opened this issue Oct 24, 2022 · 7 comments · Fixed by #151
Closed

UnsatisfiedLinkError issue on first build (React Native v0.69) #148

jhen0409 opened this issue Oct 24, 2022 · 7 comments · Fixed by #151

Comments

@jhen0409
Copy link
Contributor

jhen0409 commented Oct 24, 2022

See the error report
FATAL EXCEPTION: create_react_context

Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libv8android.so" not found: needed by /data/app/~~i0I1NaaZCLMDKne_2BVLeQ==/com.testapp-f9Qoatevq6ZoTI1QzWzlnw==/lib/arm64/libv8executor.so in namespace classloader-namespace

FATAL EXCEPTION: create_react_context
Process: com.testapp, PID: 4353
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libv8executor.so caused by: dlopen failed: library "libv8android.so" not found: needed by /data/app/~~i0I1NaaZCLMDKne_2BVLeQ==/com.testapp-f9Qoatevq6ZoTI1QzWzlnw==/lib/arm64/libv8executor.so in namespace classloader-namespace result: 0
	at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1098)
	at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:914)
	at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:826)
	at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:773)
	at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:743)
	at io.csie.kudo.reactnative.v8.executor.V8Executor.<clinit>(V8Executor.java:22)
	at io.csie.kudo.reactnative.v8.executor.V8ExecutorFactory.create(V8ExecutorFactory.java:50)
	at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1109)
	at java.lang.Thread.run(Thread.java:920)
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libv8android.so" not found: needed by /data/app/~~i0I1NaaZCLMDKne_2BVLeQ==/com.testapp-f9Qoatevq6ZoTI1QzWzlnw==/lib/arm64/libv8executor.so in namespace classloader-namespace
	at java.lang.Runtime.load0(Runtime.java:929)
	at java.lang.System.load(System.java:1620)
	at com.facebook.soloader.SoLoader$1.load(SoLoader.java:529)
	at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:110)
	at com.facebook.soloader.DirectorySoSource.loadLibrary(DirectorySoSource.java:63)
	at com.facebook.soloader.ApplicationSoSource.loadLibrary(ApplicationSoSource.java:91)
	at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1038)
	... 8 more

The first build doesn't seem to include the DSO files of react-native-v8, I see that the apk size is incorrect:

  • First build or ./gradlew clean + rebuild: apk size is 45.6MB
  • Second build: apk size is 85.1MB and it works fine

I've create a example project for reproduce the issue, it just an initial project and followed react-native-v8 setup: https://github.com/jhen0409/react-native-v8-issue-on-0.69

My environment is macOS with M1 Max chip.

I got this issue when I try to upgrade from RN 0.68 to 0.69.

@jhen0409
Copy link
Contributor Author

A temporary workaround for minimize compile time: ./gradlew extractSOFiles before build app. I use it in our CI setup.

@Kudo
Copy link
Owner

Kudo commented Nov 3, 2022

@jhen0409 could you share the full command and log for your first build?
e.g.
./gradlew clean :app:assmebleDebug is the command and ./gradlew clean :app:assembleDebug | tee build.log to generate full build log

@jhen0409
Copy link
Contributor Author

jhen0409 commented Nov 6, 2022

Build logs here (`./gradlew clean :app:assmebleDebug`)
Starting a Gradle Daemon, 1 busy Daemon could not be reused, use --status for details
> Task :react-native-gradle-plugin:compileKotlin UP-TO-DATE
> Task :react-native-gradle-plugin:compileJava UP-TO-DATE
> Task :react-native-gradle-plugin:pluginDescriptors UP-TO-DATE
> Task :react-native-gradle-plugin:processResources UP-TO-DATE
> Task :react-native-gradle-plugin:classes UP-TO-DATE
> Task :react-native-gradle-plugin:inspectClassesForKotlinIC UP-TO-DATE
> Task :react-native-gradle-plugin:jar UP-TO-DATE
> Task :app:clean
> Task :react-native-v8:cleanCmakeCache
> Task :react-native-v8:preBuild UP-TO-DATE
> Task :react-native-v8:preDebugBuild UP-TO-DATE
> Task :react-native-v8:externalNativeBuildCleanDebug
> Task :react-native-v8:preReleaseBuild UP-TO-DATE
> Task :react-native-v8:externalNativeBuildCleanRelease
> Task :react-native-v8:clean
> Task :app:generatePackageList
> Task :app:preBuild
> Task :app:preDebugBuild
> Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
> Task :react-native-v8:compileDebugAidl NO-SOURCE
> Task :app:compileDebugAidl NO-SOURCE
> Task :react-native-v8:packageDebugRenderscript NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:generateDebugBuildConfig
> Task :app:bundleDebugJsAndAssets SKIPPED
> Task :app:javaPreCompileDebug
> Task :react-native-v8:writeDebugAarMetadata
> Task :app:mergeDebugShaders
> Task :app:compileDebugShaders NO-SOURCE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :react-native-v8:mergeDebugShaders
> Task :react-native-v8:compileDebugShaders NO-SOURCE
> Task :react-native-v8:generateDebugAssets UP-TO-DATE
> Task :react-native-v8:packageDebugAssets
> Task :app:mergeDebugAssets
> Task :app:copyDebugBundledJs SKIPPED
> Task :app:generateDebugResValues
> Task :app:generateDebugResources
> Task :react-native-v8:compileDebugRenderscript NO-SOURCE
> Task :react-native-v8:generateDebugResValues
> Task :react-native-v8:generateDebugResources
> Task :react-native-v8:packageDebugResources
> Task :app:checkDebugAarMetadata
> Task :app:createDebugCompatibleScreenManifests
> Task :app:extractDeepLinksDebug
> Task :react-native-v8:extractDeepLinksDebug
> Task :react-native-v8:compileDebugLibraryResources
> Task :react-native-v8:generateDebugBuildConfig
> Task :react-native-v8:javaPreCompileDebug
> Task :app:processDebugJavaRes NO-SOURCE
> Task :react-native-v8:processDebugJavaRes NO-SOURCE
> Task :react-native-v8:bundleLibResDebug NO-SOURCE
> Task :app:compressDebugAssets
> Task :react-native-v8:parseDebugLocalResources
> Task :react-native-v8:processDebugManifest
> Task :app:mergeDebugResources
> Task :app:desugarDebugFileDependencies
> Task :app:checkDebugDuplicateClasses
> Task :app:mergeDebugJniLibFolders
> Task :react-native-v8:createNativeDepsDirectories UP-TO-DATE
> Task :app:mergeDebugJavaResource
> Task :react-native-v8:extractReactNativeAARRelease

> Task :react-native-v8:downloadGlog
Download https://github.com/google/glog/archive/v0.3.5.tar.gz

> Task :react-native-v8:extractReactNativeAARDebug
> Task :react-native-v8:prepareGlog
> Task :react-native-v8:mergeDebugJniLibFolders
> Task :app:validateSigningDebug
> Task :app:writeDebugAppMetadata
> Task :app:writeDebugSigningConfigVersions
> Task :app:processDebugMainManifest
> Task :app:processDebugManifest
> Task :app:processDebugManifestForPackage
> Task :react-native-v8:generateDebugRFile

> Task :react-native-v8:downloadBoost
Download https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz

> Task :app:processDebugResources
> Task :app:mergeExtDexDebug

> Task :react-native-v8:downloadDoubleConversion
Download https://github.com/google/double-conversion/archive/v1.1.6.tar.gz

> Task :react-native-v8:compileDebugJavaWithJavac

> Task :react-native-v8:downloadFolly
Download https://github.com/facebook/folly/archive/v2021.06.28.00.tar.gz

> Task :react-native-v8:bundleLibRuntimeToJarDebug
> Task :react-native-v8:bundleLibCompileToJarDebug

> Task :app:compileDebugJavaWithJavac

> Task :app:dexBuilderDebug
> Task :app:mergeLibDexDebug
> Task :app:mergeProjectDexDebug
> Task :react-native-v8:prepareFolly
> Task :react-native-v8:prepareDoubleConversion
> Task :react-native-v8:downloadNdkBuildDependencies
> Task :react-native-v8:prepareBoost
> Task :react-native-v8:prepareThirdPartyNdkHeaders
> Task :react-native-v8:extractAARHeaders
> Task :react-native-v8:extractSOFiles
> Task :react-native-v8:configureCMakeDebug[arm64-v8a]
> Task :react-native-v8:buildCMakeDebug[arm64-v8a]
> Task :react-native-v8:configureCMakeDebug[armeabi-v7a]
> Task :react-native-v8:buildCMakeDebug[armeabi-v7a]
> Task :react-native-v8:configureCMakeDebug[x86]
> Task :react-native-v8:buildCMakeDebug[x86]
> Task :react-native-v8:configureCMakeDebug[x86_64]
> Task :react-native-v8:buildCMakeDebug[x86_64]
> Task :react-native-v8:externalNativeBuildDebug
> Task :react-native-v8:mergeDebugNativeLibs
> Task :react-native-v8:copyDebugJniLibsProjectOnly
> Task :app:mergeDebugNativeLibs

> Task :app:stripDebugDebugSymbols
Unable to strip the following libraries, packaging them as they are: libc++_shared.so, libevent-2.1.so, libevent_core-2.1.so, libevent_extra-2.1.so, libfabricjni.so, libfb.so, libfbjni.so, libflipper.so, libfolly_runtime.so, libglog.so, libglog_init.so, libimagepipeline.so, libjscexecutor.so, libjsi.so, libjsijniprofiler.so, libjsinspector.so, liblogger.so, libmapbufferjni.so, libnative-filters.so, libnative-imagetranscoder.so, libreact_codegen_rncore.so, libreact_config.so, libreact_debug.so, libreact_nativemodule_core.so, libreact_render_animations.so, libreact_render_attributedstring.so, libreact_render_componentregistry.so, libreact_render_core.so, libreact_render_debug.so, libreact_render_graphics.so, libreact_render_imagemanager.so, libreact_render_leakchecker.so, libreact_render_mapbuffer.so, libreact_render_mounting.so, libreact_render_runtimescheduler.so, libreact_render_scheduler.so, libreact_render_telemetry.so, libreact_render_templateprocessor.so, libreact_render_textlayoutmanager.so, libreact_render_uimanager.so, libreact_utils.so, libreactnativeblob.so, libreactnativejni.so, libreactperfloggerjni.so, librrc_image.so, librrc_root.so, librrc_scrollview.so, librrc_text.so, librrc_textinput.so, librrc_unimplementedview.so, librrc_view.so, libruntimeexecutor.so, libturbomodulejsijni.so, libv8executor.so, libyoga.so.

> Task :app:packageDebug
> Task :app:createDebugApkListingFileRedirect
> Task :app:assembleDebug

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 3m 44s
81 actionable tasks: 75 executed, 6 up-to-date

If you want to see the build log with --info, I've put it in here.

@hackathon-user99
Copy link

Any update on this issue?

@Kudo
Copy link
Owner

Kudo commented Nov 11, 2022

@jhen0409 that's a great log, thanks!
i cannot repro the problem on my side at all. could you help to patch #151 locally and verify whether the fix works for you?

@jhen0409
Copy link
Contributor Author

@Kudo I confirm #151 fixed this issue. Thanks!

branch for patch #151

@Kudo Kudo closed this as completed in #151 Nov 12, 2022
Kudo added a commit that referenced this issue Nov 12, 2022
# Why

fix #148 

# How

might be a AGP 7 issue: https://issuetracker.google.com/issues/195318431. this pr references the fix from software-mansion/react-native-reanimated#3056 and uses `afterEvaluate` rather than `tasks.whenTaskAdded`.
@Kudo
Copy link
Owner

Kudo commented Nov 12, 2022

@jhen0409 thanks for the great help. published react-native-v8@1.5.3 with the fix 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants