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

Fresh Install Android Broken on React Native 0.60 RC2 #25415

Closed
canpoyrazoglu opened this issue Jun 27, 2019 · 39 comments
Closed

Fresh Install Android Broken on React Native 0.60 RC2 #25415

canpoyrazoglu opened this issue Jun 27, 2019 · 39 comments
Labels
Bug Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@canpoyrazoglu
Copy link

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?

@react-native-bot react-native-bot added the Platform: Android Android applications. label Jun 27, 2019
@dulmandakh
Copy link
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
Copy link
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
Copy link

mehulmpt commented Jul 4, 2019

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
Copy link

Villar74 commented Jul 5, 2019

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

@chrisspankroy
Copy link

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

@sumudu-dewasurendra
Copy link

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
Copy link
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.

@dulmandakh dulmandakh reopened this Jul 7, 2019
@ivan-navarro-75
Copy link

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
Copy link

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
Copy link

Villar74 commented Jul 9, 2019

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

@PatrickLambert1101
Copy link

Same issue here

@sett21
Copy link

sett21 commented Jul 9, 2019

Same issue

@chrisspankroy
Copy link

chrisspankroy commented Jul 9, 2019

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

@ivan-navarro-75
Copy link

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

@Villar74
Copy link

#25537 (comment) i found fix that helped me

@mhrpatel12
Copy link

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.

@ivan-navarro-75
Copy link

ivan-navarro-75 commented Jul 10, 2019

with this #25415 (comment) 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)

@ghost
Copy link

ghost commented Jul 10, 2019

I upgaded react-native from 0.56.0 to 0.60.0 using https://github.com/react-native-community/rn-diff-purge/compare/release/0.56.0..release/0.60.0#diff-1bcdc04ee1388d1458277d59136926e8. I did all changes as mentioned in the above link. But am getting error :

BUILD FAILED in 44s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ':app:preDebugBuild'.

Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
Could not find com.androidx.appcompat:28.0.0:.
Required by:
project :app
Could not find any matches for com.google.maps.android:android-maps-utils:0.5+ as no versions of com.google.maps.android:android-maps-utils are available.
Required by:
project :app
project :app > project :react-native-maps
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :app > project :react-native-signature-capture
Could not find any version that matches com.facebook.react:react-native:0.19.+.
Versions that do not match: 0.60.0
Required by:
project :app > project :react-native-signature-capture
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :app > project :react-native-share
project :app > project :react-native-fbsdk
project :app > project :lottie-react-native
Could not find com.facebook.android:facebook-android-sdk:4.34.0.
Required by:
project :app > project :react-native-fbsdk
Could not find com.clock.scratch:Scratch:1.0.0.
Required by:
project :app > project :react-native-scratch-card
Could not find com.airbnb.android:lottie:2.5.6.
Required by:
project :app > project :lottie-react-native
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :app > project :react-native-smart-splash-screen
Could not find com.onesignal:OneSignal:3.10.3.
Required by:
project :app > project :react-native-onesignal
Could not find any version that matches com.facebook.react:react-native:0.20.+.
Versions that do not match: 0.60.0
Required by:
project :app > project :react-native-charts-wrapper
Could not find com.itextpdf:itextg:5.5.9.
Required by:
project :app > project :react-native-image-to-pdf
Could not find com.facebook.infer.annotation:infer-annotation:0.11.2.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find javax.inject:javax.inject:1.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find com.facebook.fresco:fresco:2.0.0.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find com.facebook.fresco:imagepipeline-okhttp3:2.0.0.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find com.facebook.soloader:soloader:0.6.0.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find com.google.code.findbugs:jsr305:3.0.2.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find com.squareup.okhttp3:okhttp:3.12.1.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find com.squareup.okhttp3:okhttp-urlconnection:3.12.1.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find com.squareup.okio:okio:1.15.0.
Required by:
project :app > com.facebook.react:react-native:0.60.0

@ghost
Copy link

ghost commented Jul 10, 2019

I upgaded react-native from 0.56.0 to 0.60.0 using https://github.com/react-native-community/rn-diff-purge/compare/release/0.56.0..release/0.60.0#diff-1bcdc04ee1388d1458277d59136926e8. I did all changes as mentioned in the above link. But am getting error :

BUILD FAILED in 44s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ':app:preDebugBuild'.

Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
Could not find com.androidx.appcompat:28.0.0:.
Required by:
project :app
Could not find any matches for com.google.maps.android:android-maps-utils:0.5+ as no versions of com.google.maps.android:android-maps-utils are available.
Required by:
project :app
project :app > project :react-native-maps
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :app > project :react-native-signature-capture
Could not find any version that matches com.facebook.react:react-native:0.19.+.
Versions that do not match: 0.60.0
Required by:
project :app > project :react-native-signature-capture
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :app > project :react-native-share
project :app > project :react-native-fbsdk
project :app > project :lottie-react-native
Could not find com.facebook.android:facebook-android-sdk:4.34.0.
Required by:
project :app > project :react-native-fbsdk
Could not find com.clock.scratch:Scratch:1.0.0.
Required by:
project :app > project :react-native-scratch-card
Could not find com.airbnb.android:lottie:2.5.6.
Required by:
project :app > project :lottie-react-native
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :app > project :react-native-smart-splash-screen
Could not find com.onesignal:OneSignal:3.10.3.
Required by:
project :app > project :react-native-onesignal
Could not find any version that matches com.facebook.react:react-native:0.20.+.
Versions that do not match: 0.60.0
Required by:
project :app > project :react-native-charts-wrapper
Could not find com.itextpdf:itextg:5.5.9.
Required by:
project :app > project :react-native-image-to-pdf
Could not find com.facebook.infer.annotation:infer-annotation:0.11.2.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find javax.inject:javax.inject:1.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find com.facebook.fresco:fresco:2.0.0.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find com.facebook.fresco:imagepipeline-okhttp3:2.0.0.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find com.facebook.soloader:soloader:0.6.0.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find com.google.code.findbugs:jsr305:3.0.2.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find com.squareup.okhttp3:okhttp:3.12.1.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find com.squareup.okhttp3:okhttp-urlconnection:3.12.1.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find com.squareup.okio:okio:1.15.0.
Required by:
project :app > com.facebook.react:react-native:0.60.0

Anybody help me to resolve this issue.

@Villar74
Copy link

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

@AntonioErdeljac
Copy link

AntonioErdeljac commented Aug 12, 2019

@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 :)

@SatishMavani
Copy link

SatishMavani commented Aug 19, 2019

2019-08-20 00:38:26.816 27139-27139/? E/SoLoader: couldn't find DSO to load: libjscexecutor.so
2019-08-20 00:38:27.189 27139-27188/appPackageName/SoLoader: couldn't find DSO to load: libhermes.so

Have anyone found solution?

@yurykorzun
Copy link
Contributor

if you have this error it means that you have a jsc aar missing, you can find it in node_modules\jsc-android\dist

Make sure it is included in your dependencies

@tayfunyasar
Copy link

I'm also facing same issue.

@YingVickyCao
Copy link

YingVickyCao commented Sep 23, 2019

Have same error:

E/SoLoader: couldn't find DSO to load: libjscexecutor.so
E/SoLoader: couldn't find DSO to load: libhermes.so

Details:

E/SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed:
 library "libjsc.so" not found

E//SoLoader: couldn't find DSO to load: libhermes.so
    
    --------- beginning of crash
/AndroidRuntime: FATAL EXCEPTION: create_react_context
    Process: com.test, PID: 7227
    java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
        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.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20)
        at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:27)
        at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:949)
        at java.lang.Thread.run(Thread.java:764)

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "androidx.appcompat:appcompat:1.1.0"
    implementation "com.facebook.react:react-native:0.60.5"  // From node_modules
}

@saadmutahar
Copy link

Is there are any workaround for this issue?

@Wil2129
Copy link

Wil2129 commented Oct 12, 2019

Did anyone try to use targetSdkVersion and compileSdkVersion 28 ? With build-tools 28.0.3 ? I think react native has a problem with sdkVersion 29 because when I couldn't run with it sdkVersion 29 and I had to revert to sdkVersion 28. May be I did a bad config but you guys should try that out.

@saadmutahar
Copy link

saadmutahar commented Oct 13, 2019

Here's a work around that fixes the issue:

Do npm i jsc-android
put the below lines of code in package.json

{
  "name": "ABC",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "postinstall": "npx jetify"
  },
  "dependencies": {
    "jsc-android": "^241213.0.0",
    "react": "^16.8.6",
    "react-native": "0.60.0",
  },
  "devDependencies": {
    "jetifier": "^1.6.4",
  },
}

put the below lines of code in allProjects/repositories in android build.gradle file

allprojects {
    repositories {
        mavenLocal()
        maven {
            url 'https://maven.google.com/'
        }
        jcenter()
        maven {
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
    }
}

put the below lines of code in app build.gradle

def useIntlJsc = true // top of the file
apply plugin: "com.android.application"
import com.android.build.OutputFile
apply from: "../../node_modules/react-native/react.gradle"

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId "com.abc"
        multiDexEnabled true
        minSdkVersion 18
        targetSdkVersion 28
        versionCode 1
        versionName "1"
        ndk {
            abiFilters "armeabi-v7a",'x86',"arm64-v8a",'x86_64'
        }
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }

    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86-64"
        }
    }
    packagingOptions {
        pickFirst '**/libjsc.so'
        pickFirst '**/libc++_shared.so'
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }

 }

  dependencies {
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'androidx.arch.core:core-runtime:2.0.0'
    implementation 'androidx.arch.core:core-common:2.0.0'
    implementation "org.webkit:android-jsc:r241213"

 }

in gradle.properties

android.useAndroidX=true
android.enableJetifier=true

@nolife08021
Copy link

@saadmutahar hi, can you help me to check my build.gradle file? I still facing the same issue

def useIntlJsc = true // top of the file
apply plugin: "com.android.application"
apply plugin: 'io.fabric'
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

import com.android.build.OutputFile

project.ext.react = [
entryFile: "index.js",
bundleInStaging: true, // Add this
bundleInInternalTest: true, // Add this
enableHermes: false, // clean and rebuild if changing
]

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

def jscFlavor = 'org.webkit:android-jsc:+'

def enableHermes = project.ext.react.get("enableHermes", false);

android {
compileSdkVersion rootProject.ext.compileSdkVersion

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
    applicationId "com.testingandroid"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    missingDimensionStrategy 'react-native-camera', 'general'
    versionCode 1
    versionName "1"
    multiDexEnabled true
    ndk {
        abiFilters "armeabi-v7a",'x86',"arm64-v8a",'x86_64'
    }
}
dexOptions {
    javaMaxHeapSize "4g"
}
splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // If true, also generate a universal APK
        include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
    }
}
packagingOptions {
    pickFirst '**/libjsc.so'
    pickFirst '**/libc++_shared.so'
}
signingConfigs {
    debug {
        storeFile file('debug.keystore')
        storePassword 'android'
        keyAlias 'androiddebugkey'
        keyPassword 'android'
    }
}
buildTypes {
    debug {
        signingConfig signingConfigs.debug
    }
    release {
        // Caution! In production, you need to generate your own keystore file.
        // see https://facebook.github.io/react-native/docs/signed-apk-android.
        signingConfig signingConfigs.release
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
    }
}

// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
    variant.outputs.each { output ->
        // For each separate APK per architecture, set a unique version code as described here:
        // https://developer.android.com/studio/build/configure-apk-splits.html
        def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
        def abi = output.getFilter(OutputFile.ABI)
        if (abi != null) {  // null for the universal-debug, universal-release variants
            output.versionCodeOverride =
                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
        }

    }
}

}
configurations.all {
resolutionStrategy {
force "com.google.android.gms:play-services-base:16.1.0"
force "com.google.android.gms:play-services-gcm:16.1.0"
force "com.google.android.gms:play-services-ads:17.2.0" }
}

dependencies {
implementation "org.webkit:android-jsc:r241213"
def multidex_version = "2.0.1"
implementation "androidx.multidex:multidex:$multidex_version"
implementation project(':react-native-firebase')
implementation project(':react-native-push-notification')
implementation project(':react-native-image-crop-picker')
implementation "com.google.android.gms:play-services-base:17.1.0"
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') {
transitive = true
}
implementation 'me.leolin:ShortcutBadger:1.1.22@aar' // <-- Add this line if you wish to use badge on Android
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "androidx.core:core:1.1.0"
implementation "androidx.annotation:annotation:1.1.0"
implementation "androidx.appcompat:appcompat:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation ('com.google.android.gms:play-services-ads:16.+') { force = true; }
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply plugin: 'com.google.gms.google-services'

@saadmutahar
Copy link

saadmutahar commented Oct 17, 2019

@nolife08021 It looks like you're going good with app build file, did you follow every steps as I mentioned above. If so please share your package.json file and project build file also.

@nolife08021
Copy link

@nolife08021 It looks like you're going good with app build file, did you follow every steps as I mentioned above. If so please share your package.json file and project build file also.

@saadmutahar here's my package.json file and project build file. Thanks

package.json

{
"name": "testingandroid",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"@react-native-community/async-storage": "^1.6.2",
"@react-native-community/netinfo": "^4.3.2",
"buffer": "^5.4.3",
"deprecated-react-native-listview": "0.0.5",
"jsc-android": "^241213.1.0",
"lottie-ios": "^3.1.3",
"lottie-react-native": "^3.2.1",
"moment": "^2.24.0",
"moment-timezone": "^0.5.26",
"react": "^16.9.0",
"react-dom": "^16.10.2",
"react-moment": "^0.9.2",
"react-native": "0.61.2",
"react-native-admob": "^2.0.0-beta.6",
"react-native-animatable": "^1.3.2",
"react-native-app-intro-slider": "^3.0.0",
"react-native-badger-android": "^1.0.4",
"react-native-camera": "^3.6.0",
"react-native-collapse-view": "^1.0.0",
"react-native-country-picker-modal": "^1.1.0",
"react-native-custom-checkbox": "^1.5.2",
"react-native-datepicker": "^1.7.2",
"react-native-device-info": "^3.1.4",
"react-native-exit-app": "^1.1.0",
"react-native-firebase": "^5.5.6",
"react-native-form-validator": "^0.2.0",
"react-native-image-crop-picker": "^0.25.3",
"react-native-image-pan-zoom": "^2.1.11",
"react-native-image-resizer": "^1.0.1",
"react-native-image-zoom-viewer": "^2.2.26",
"react-native-keyboard-aware-scroll-view": "^0.9.1",
"react-native-loading-spinner-overlay": "^1.0.1",
"react-native-material-bottom-navigation": "^1.0.4",
"react-native-material-buttons": "^0.6.0",
"react-native-md5": "^1.0.0",
"react-native-modal": "^11.4.0",
"react-native-numeric-input": "^1.8.3",
"react-native-offline": "^5.1.0",
"react-native-paper": "^2.16.0",
"react-native-permissions": "^2.0.0",
"react-native-pure-chart": "0.0.24",
"react-native-push-notification": "^3.1.9",
"react-native-qrcode-scanner": "^1.2.3",
"react-native-render-html": "^4.1.2",
"react-native-responsive-screen": "^1.3.0",
"react-native-restart": "0.0.13",
"react-native-secure-key-store": "^2.0.5",
"react-native-simple-radio-button": "^2.7.3",
"react-native-sqlite-storage": "^4.1.0",
"react-native-super-grid": "^3.1.1",
"react-native-svg": "^9.11.1",
"react-native-swipeout": "^2.3.6",
"react-native-switch": "^1.5.0",
"react-native-validation": "^1.0.2",
"react-native-vector-icons": "^6.6.0",
"react-native-web": "^0.11.7",
"react-native-webview": "^7.4.1",
"react-navigation": "^2.3.0",
"victory-native": "^33.0.0"
},
"devDependencies": {
"@babel/core": "7.6.2",
"@babel/runtime": "7.6.2",
"jetifier": "^1.6.4",
"@react-native-community/eslint-config": "0.0.3",
"babel-jest": "24.9.0",
"eslint": "6.5.1",
"jest": "24.9.0",
"metro-react-native-babel-preset": "0.51.1",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}

root/build.gradle

`// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 19
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "1.0.0-beta01"
}
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
maven {
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.2")
classpath 'com.google.gms:google-services:4.3.2'
classpath 'io.fabric.tools:gradle:1.31.0' // for Firebase Crashlytics
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
mavenLocal()
maven {
url 'https://maven.google.com/'
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
`

@saadmutahar
Copy link

saadmutahar commented Oct 17, 2019

@nolife08021 please don't forgot to write "postinstall": "npx jetify" in your package.json file.
After that do npm i install.

{
"name": "testingandroid",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"postinstall": "npx jetify"
"lint": "eslint ."
},

@nolife08021
Copy link

@saadmutahar Thanks!!!!! I am able to launch the app now. Can you please explain to me that what this code means??
"postinstall": "npx jetify"

@saadmutahar
Copy link

saadmutahar commented Oct 17, 2019

@saadmutahar Thanks!!!!! I am able to launch the app now. Can you please explain to me that what this code means??
"postinstall": "npx jetify"

Great to hear that you are able to run the app.

This is because some of your React Native modules with native Java code that isn't converted to AndroidX, and your app is AndroidX, you probably need this.

@co-de
Copy link

co-de commented Nov 11, 2019

Here's a work around that fixes the issue:

Do npm i jsc-android
put the below lines of code in package.json

{
  "name": "ABC",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "postinstall": "npx jetify"
  },
  "dependencies": {
    "jsc-android": "^241213.0.0",
    "react": "^16.8.6",
    "react-native": "0.60.0",
  },
  "devDependencies": {
    "jetifier": "^1.6.4",
  },
}

put the below lines of code in allProjects/repositories in android build.gradle file

allprojects {
    repositories {
        mavenLocal()
        maven {
            url 'https://maven.google.com/'
        }
        jcenter()
        maven {
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
    }
}

put the below lines of code in app build.gradle

def useIntlJsc = true // top of the file
apply plugin: "com.android.application"
import com.android.build.OutputFile
apply from: "../../node_modules/react-native/react.gradle"

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId "com.abc"
        multiDexEnabled true
        minSdkVersion 18
        targetSdkVersion 28
        versionCode 1
        versionName "1"
        ndk {
            abiFilters "armeabi-v7a",'x86',"arm64-v8a",'x86_64'
        }
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }

    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86-64"
        }
    }
    packagingOptions {
        pickFirst '**/libjsc.so'
        pickFirst '**/libc++_shared.so'
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }

 }

  dependencies {
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'androidx.arch.core:core-runtime:2.0.0'
    implementation 'androidx.arch.core:core-common:2.0.0'
    implementation "org.webkit:android-jsc:r241213"

 }

in gradle.properties

android.useAndroidX=true
android.enableJetifier=true

This worked for me without "postinstall": "npx jetify"
Thanks!

@anastely
Copy link

Any updates?

@bhanu-sagar
Copy link

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

@stale
Copy link

stale bot commented May 30, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label May 30, 2020
@stale
Copy link

stale bot commented Jun 6, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Jun 6, 2020
@facebook facebook locked as resolved and limited conversation to collaborators Jun 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests