Skip to content

Fresh Install Android Broken on React Native 0.60 RC2 #25415

@canpoyrazoglu

Description

@canpoyrazoglu

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?

Activity

dulmandakh

dulmandakh commented on Jun 28, 2019

@dulmandakh
Contributor

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.

canpoyrazoglu

canpoyrazoglu commented on Jun 28, 2019

@canpoyrazoglu
Author

@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.

mehulmpt

mehulmpt commented on Jul 4, 2019

@mehulmpt

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?

Villar74

Villar74 commented on Jul 5, 2019

@Villar74

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

chrisspankroy

chrisspankroy commented on Jul 5, 2019

@chrisspankroy

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

sumudu-dewasurendra

sumudu-dewasurendra commented on Jul 6, 2019

@sumudu-dewasurendra

When I use react-native run-android command Metro server start. But after few seconds later its getting closed. Do we need to run it by other command or its a bug in react native 0.60.0 version

canpoyrazoglu

canpoyrazoglu commented on Jul 6, 2019

@canpoyrazoglu
Author

@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.

ivan-navarro-75

ivan-navarro-75 commented on Jul 7, 2019

@ivan-navarro-75

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.
mhrpatel12

mhrpatel12 commented on Jul 7, 2019

@mhrpatel12

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.

Villar74

Villar74 commented on Jul 9, 2019

@Villar74

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

Yep, after doing some fixes from google get this one too

36 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugPlatform: AndroidAndroid applications.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @dulmandakh@tayfunyasar@yurykorzun@canpoyrazoglu@sett21

        Issue actions

          Fresh Install Android Broken on React Native 0.60 RC2 · Issue #25415 · facebook/react-native