Building React Native from source failed
See original GitHub issue- The following error is found in gradle sync phase:
ERROR: Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:7:5-117 to override.
It could be fixed by adding the following two lines,
android.useAndroidX=true
android.enableJetifier=true
to gradle.properties
of the app project
- Then comes to the second error,
06-06 17:59:17.698 26292-26336/com.fromsource E/dalvikvm: dlopen("/data/app-lib/com.fromsource-1/libjscexecutor.so") failed: dlopen failed:
06-06 17:59:17.698 26292-26336/com.fromsource E/SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed:
06-06 17:59:17.698 26292-26336/com.fromsource W/dalvikvm: Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/facebook/react/jscexecutor/JSCExecutor;
06-06 17:59:17.698 26292-26336/com.fromsource W/dalvikvm: threadid=18: thread exiting with uncaught exception (group=0x418ccc68)
06-06 17:59:17.708 26292-26336/com.fromsource E/AndroidRuntime: FATAL EXCEPTION: create_react_context
Process: com.fromsource, PID: 26292
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed:
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:738)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:591)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:529)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:484)
at com.facebook.react.jscexecutor.JSCExecutor.<clinit>(JSCExecutor.java:19)
at com.facebook.react.jscexecutor.JSCExecutorFactory.create(JSCExecutorFactory.java:29)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:956)
at java.lang.Thread.run(Thread.java:841)
06-06 17:59:17.768 26292-26292/com.fromsource W/linker: library "libmaliinstr.so" not found
Which can be fixed by removing the following line (271)
task packageReactNdkLibs(dependsOn: buildReactNdkLib, type: Copy) {
from("$buildDir/react-ndk/all")
into("$buildDir/react-ndk/exported")
exclude("**/libjsc.so") <-----------------------remove this line
}
in build.gradle
of ReactAndroid
project
React Native version: master react-native-cli version: 2.0.1
Steps To Reproduce
- Create a React Native app using
react-native-cli
(version as indicated above) - Follow the instructions from https://github.com/facebook/react-native/wiki/Building-from-source
Describe what you expected to happen (next):
- Add AndroidX related instructions to the https://github.com/facebook/react-native/wiki/Building-from-source
- Not sure why
exclude("**/libjsc.so")
is there. If it is not intentional (for another deployment path), then it is required to be removed.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:14 (1 by maintainers)
Top Results From Across the Web
build from source fail · Issue #34155 · facebook/react-native
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Read more >How to Build from Source - React Native
You will need to build React Native from source if you want to work on a new feature/bug fix, try out the latest...
Read more >React Native Android build failure with different errors without ...
Reason for Failures : The build failures for Android was due to the publish of the React Native version 0.71.0-rc0 to Maven and...
Read more >Building React Native from source
You will need to build React Native from source if you want to work on a new feature/bug fix, try out the latest...
Read more >Addressing common errors in React Native - LogRocket Blog
This error message says that the build process wasn't successful and also specifies the particular command that failed. Sometimes you can get ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@felansu lol I got that
react-native-camera
too. wonder if upgrade to androidx is correct path or notsolved it:
yarn add react-native-device-info@2.1.2
clean and rebuild
I hit this as well and was able to resolve the issue by following the instructions above.
Thanks @holmeshe! You saved me a lot of time!