react-native: Fresh Install Android Broken on React Native 0.60 RC2

As React Native will default to AndroidX from 0.60, I want to upgrade my project to 0.60RC2 and AndroidX but I can’t get it to working. I can reproduce it with a fresh project.

React Native version:

System:
    OS: macOS 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
    Memory: 67.11 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.4.0 - /usr/local/bin/node
    Yarn: 1.17.0 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5522156
    Xcode: 10.2/10E125 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.3 => 16.8.3 
    react-native: 0.60.0-rc.2 => 0.60.0-rc.2 
  npmGlobalPackages:
    react-native-cli: 2.0.1

Steps To Reproduce

  1. Create a new React Native Project react-native init testproject (it creates a project using "react-native": "0.59.9" dependency).
  2. Make sure your emulator is running. Try to run cd /Users/Can/Desktop/testproject && react-native run-android (replace path with yours).
  3. In my case it couldn’t find the Android SDK, so I added local.properties into android folder with the content sdk.dir=/Users/Can/Library/Android/sdk (replace it with your Android SDK path)
  4. Run react-native run-android again. It runs perfectly. It displays the default Hello World app screen on my emulator.
  5. Open package.json and switch RN version to 0.60 RC2: "react-native": "0.60.0-rc.2"
  6. Run npm install to update to latest version.
  7. Try running react-native run-android again. It errors Task :app:processDebugManifest FAILED:
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> 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.

What I’ve tried:

  • As the error message suggests, I’ve added tools:replace="android:appComponentFactory" to application tag in my project’s root AndroidManifest.xml and tried running again. Then I got a different error:
> org.xml.sax.SAXParseException; systemId: file:/Users/Can/Desktop/testproject/android/app/src/main/AndroidManifest.xml; lineNumber: 13; columnNumber: 39; The prefix "tools" for attribute "tools:replace" associated with an element type "application" is not bound.

After a quick Googling I’ve found this comment where it suggests to add xmlns:tools="http://schemas.android.com/tools" to the manifest’s root tag, so I did it. When I ran, this time I got:

Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/Can/Desktop/testproject/android/app/src/main/AndroidManifest.xml:6:5-25:19 Error:
	tools:replace specified at line:6 for attribute android:appComponentFactory, but no new value specified

After Googling that too I’ve stumbled upon a StackOverflow question regarding the same issue with this answer: It tells, if migrating to AndroidX (which RN 0.60 uses by default), to remove those tags from manifest and add the following lines to gradle.properties:

android.useAndroidX=true
android.enableJetifier=true

So I did those. Now, the build succeeds on RN 0.60, but immedieately at launch I’m getting the following error in LogCat and the app crashes on launch:

2019-06-27 23:30:34.151 8014-8047/com.testproject E/SoLoader: Error when loading lib: dlopen failed: library "libjsc.so" not found lib hash: 9f147276937ca9f5dfbf5ff8b8b470c1 search path is /data/app/com.testproject-LdIs8_kVqRM_R_hH6wP35g==/lib/x86
2019-06-27 23:30:34.152 8014-8047/com.testproject E/SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
    
    --------- beginning of crash
2019-06-27 23:30:34.156 8014-8047/com.testproject E/AndroidRuntime: FATAL EXCEPTION: create_react_context
    Process: com.testproject, PID: 8014
    java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
        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:949)
        at java.lang.Thread.run(Thread.java:764)

I’ve then Googled dlopen failed: library "libjsc.so" not found and stumbled upon someone having the same issue after upgrading to 0.60 RC2. I’ve tried the accepted answer and added def useIntlJsc = false to the top of app/build.gradle and the following snippet into dependencies:

   if (useIntlJsc) {
        implementation 'org.webkit:android-jsc-intl:+'
    } else {
        implementation 'org.webkit:android-jsc:+'
    }

At this point nothing changed and I keep getting the same error. In addition to the steps above, (I know the following is unreproducible but may hint to a clue) when I tried the same steps in my actual project, this last answer worked, but then I got an error saying libgnustl_shared.so instead of libjsc.so.

Describe what you expected to happen:

I expected a fresh package to run normally with 0.60.


How can I get React Native 0.60 working with Android?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 26
  • Comments: 39 (2 by maintainers)

Most upvoted comments

Found a fix, this works for me (based off of the suggestion over at #25537):

Do an

npm install --save jsc-android

Then make sure to add this jsc-android block to your android/build.gradle:

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }

        //THIS ONE
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
    }
}

If you already have this block in your android/build.gradle make sure $rootDir/../node_modules/jsc-android/dist is a valid path in your project. If not, make sure you do the npm install --save jsc-android

Note: This fixes the crash caused by libjsc.so, but the error about No implementation found for com.facebook.react.bridge.Inspector is still being logged. It’s being tracked at #25560

@dulmandakh Please reconsider reopening this issue, as I’ve said I’m not using any third party modules, and many other people here are having the same problem with me.

I looks like you use native module that depends support-library, instead of AndroidX, and causing conflicts. Please make sure that third-party modules you use are AndroidX compatible or check out https://github.com/mikehardy/jetifier.

This is also happening with React Native v0.60.0 (the full release, not an RC)

Why this issue closed??? i’m facing the same problem

@PravsReddy

You probably had this in your build.gradle

implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"

Or something similar that specifies your version to 28.0.0

Then if you followed the migration table from https://developer.android.com/jetpack/androidx/migrate you probably saw that com.android.support:appcompat-v7 was replaced with androidx.appcompat:appcompat:1.0.0

and thought that 1.0.0 should be replaced with ${rootProject.ext.supportLibVersion} or whatever dynamic versioning you had in the initial implementation. It needs to be exactly

androidx.appcompat:appcompat:1.0.0 . So, final solution:

- implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
+ implementation "androidx.appcompat:appcompat:1.0.0"

Hope this helps someone who stumbles across this 😃

@dulmandakh Which third party module exactly? I am trying to run a clean, fresh, newly created project created with react-native init command. I’m not using anything third party.

I’m also facing the same issue. Getting another error along with libjscexecutor.so,

2019-07-07 18:59:28.440 10045-10076/com.mihir.reactApp E/.mihir.reactAp: No implementation found for com.facebook.react.bridge.Inspector com.facebook.react.bridge.Inspector.instance() (tried Java_com_facebook_react_bridge_Inspector_instance and Java_com_facebook_react_bridge_Inspector_instance__)
2019-07-07 18:59:28.449 10045-10076/com.mihir.reactApp E/unknown:ReactNative: Inspector doesn't work in open source yet
    java.lang.UnsatisfiedLinkError: No implementation found for com.facebook.react.bridge.Inspector com.facebook.react.bridge.Inspector.instance() (tried Java_com_facebook_react_bridge_Inspector_instance and Java_com_facebook_react_bridge_Inspector_instance__)
        at com.facebook.react.bridge.Inspector.instance(Native Method)
        at com.facebook.react.bridge.Inspector.getPages(Inspector.java:27)
        at com.facebook.react.devsupport.InspectorPackagerConnection.getPages(InspectorPackagerConnection.java:152)
        at com.facebook.react.devsupport.InspectorPackagerConnection.handleProxyMessage(InspectorPackagerConnection.java:72)
        at com.facebook.react.devsupport.InspectorPackagerConnection$Connection.onMessage(InspectorPackagerConnection.java:223)
        at okhttp3.internal.ws.RealWebSocket.onReadMessage(RealWebSocket.java:323)
        at okhttp3.internal.ws.WebSocketReader.readMessageFrame(WebSocketReader.java:219)
        at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.java:105)
        at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.java:274)
        at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:214)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:206)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)

Also, I’m not using any third partly library or anything. Getting this error on fresh Android Application.

Same issue during the react native integration with an existing app

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.0"
    defaultConfig {
        applicationId "com.example.reactnativeintegration"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    implementation "com.facebook.react:react-native:0.60.0"
}
E/SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
W/unknown:ReactNative: Packager connection already open, nooping.
    
    --------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: create_react_context
    Process: com.example.reactnativeintegration, PID: 18713
    java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
        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:949)
        at java.lang.Thread.run(Thread.java:919)
I/Process: Sending signal. PID: 18713 SIG: 9
Application terminated.

@PravsReddy Offtopic, no one will help you here. Create new bug if you think it is

Same issue

I’m facing similar issue on an app porting from 0.59.9 to 0.60.0. I’ve already run npx jetify and it exits without any error message. Is there any update on this?

with this https://github.com/facebook/react-native/issues/25415#issuecomment-509966579 at least now I can see the react-native component

I’ve just needed to add this line to my app build.gradle implementation 'org.webkit:android-jsc:+'

but the error with the bridge is still there

2019-07-10 12:31:54.454 10143-11291/com.example.reactnativeintegration E/tiveintegratio: No implementation found for com.facebook.react.bridge.Inspector com.facebook.react.bridge.Inspector.instance() (tried Java_com_facebook_react_bridge_Inspector_instance and Java_com_facebook_react_bridge_Inspector_instance__)
2019-07-10 12:31:54.455 10143-11291/com.example.reactnativeintegration E/unknown:ReactNative: Inspector doesn't work in open source yet
    java.lang.UnsatisfiedLinkError: No implementation found for com.facebook.react.bridge.Inspector com.facebook.react.bridge.Inspector.instance() (tried Java_com_facebook_react_bridge_Inspector_instance and Java_com_facebook_react_bridge_Inspector_instance__)
        at com.facebook.react.bridge.Inspector.instance(Native Method)
        at com.facebook.react.bridge.Inspector.getPages(Inspector.java:27)
        at com.facebook.react.devsupport.InspectorPackagerConnection.getPages(InspectorPackagerConnection.java:152)
        at com.facebook.react.devsupport.InspectorPackagerConnection.handleProxyMessage(InspectorPackagerConnection.java:72)
        at com.facebook.react.devsupport.InspectorPackagerConnection$Connection.onMessage(InspectorPackagerConnection.java:223)
        at okhttp3.internal.ws.RealWebSocket.onReadMessage(RealWebSocket.java:323)
        at okhttp3.internal.ws.WebSocketReader.readMessageFrame(WebSocketReader.java:219)
        at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.java:105)
        at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.java:274)
        at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:214)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:206)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)

these changes makes things working for me. Still, I don’t really know what’s wrong. Because without those changes also everything works perfectly on react-native V.0.59.10. I also don’t see any official documentation regarding this.

the previous fix doesn’t work for me, I still have the same couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found issue