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

[0.60.3] App crash on startup when enabling Hermes (enableHermes: true) #25601

Closed
bhaskarGyan opened this issue Jul 12, 2019 · 122 comments
Closed
Labels
Bug Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.

Comments

@bhaskarGyan
Copy link

App is crashing when I enable Hermes in android/app/build.gradle. App is working fine with react-native 0.60.3 with enableHermes: false

Error:

07-12 08:06:59.097 20330-20330/com.reactnativememoryprofile E/SoLoader: couldn't find DSO to load: libjscexecutor.so 07-12 08:06:59.123 20330-20345/com.reactnativememoryprofile E/SoLoader: couldn't find DSO to load: libhermes.so 07-12 08:06:59.124 20330-20345/com.reactnativememoryprofile E/AndroidRuntime: FATAL EXCEPTION: create_react_context Process: com.reactnativememoryprofile, PID: 20330 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:818)

React Native version:
System:
OS: macOS 10.14.5
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 373.31 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.15.1 - /usr/local/bin/node
Yarn: 1.13.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
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28
Build Tools: 21.1.2, 23.0.1, 25.0.0, 25.0.1, 25.0.2, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.2, 28.0.3, 29.0.0
System Images: android-23 | Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom_64, android-27 | Android TV Intel x86 Atom, android-27 | Intel x86 Atom, android-27 | Intel x86 Atom_64, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64
Android NDK: 20.0.5594570
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5522156
Xcode: 10.2/10E125 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: ^0.60.3 => 0.60.3
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-create-library: 3.1.2
react-native-git-upgrade: 0.2.7
m-c02xf2cejg5h:reactNativeMemoryProfi

Steps To Reproduce

  1. Follow the steps mentioned in hermes
  2. react-native run-android --variant release

Describe what you expected to happen:
App should not crash

Snack, code example, or link to a repository:

https://github.com/bhaskarGyan/react-native-memory-profile/tree/bug/rn-0.60.3_hermes

@bhaskarGyan bhaskarGyan changed the title [0.60.3] App crash on startup with when enabling Hermes (enableHermes: true) [0.60.3] App crash on startup when enabling Hermes (enableHermes: true) Jul 12, 2019
@Karniej
Copy link

Karniej commented Jul 12, 2019

The same thing is happening to me, the build is successful, but:

  1. The metro bundler doesn't start up
  2. I have this error
    2019-07-12 09:26:37.060 4759-4796/com.tests E/SoLoader: couldn't find DSO to load: libhermes.so --------- beginning of crash 2019-07-12 09:26:37.062 4759-4796/com.sherlock E/AndroidRuntime: FATAL EXCEPTION: create_react_context Process: com.tests, PID: 4759 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)

@benoitdion
Copy link
Contributor

you'll need to add

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

at the top of your build.gradle file and

  if (enableHermes) {
    def hermesPath = "../../node_modules/hermesvm/android/";
    debugImplementation files(hermesPath + "hermes-debug.aar")
    releaseImplementation files(hermesPath + "hermes-release.aar")
  } else {
    implementation jscFlavor
  }

in your dependencies.

Should we move those bits of configuration to react.gradle?

@mjmasn
Copy link
Contributor

mjmasn commented Jul 12, 2019

If you have additional build types those will need to be added too, e.g.

    integrationImplementation files(hermesPath + "hermes-release.aar")
    stagingImplementation files(hermesPath + "hermes-release.aar")

Because we have a few build types, and apart from debug they should all be in release mode, I also had to add some react.gradle fixes. We have a custom react.gradle so this wasn't too much trouble. Basically changing targetName.toLowerCase().contains("release") to !targetName.toLowerCase().contains("debug").

if (!targetName.toLowerCase().contains("debug")) {
    // Can't use ?: since that will also substitute valid empty lists
    hermesFlags = config.hermesFlagsRelease
    if (hermesFlags == null) hermesFlags = ["-O", "-output-source-map"]
} else {
    hermesFlags = config.hermesFlagsDebug
    if (hermesFlags == null) hermesFlags = []
}

and

// Delete the VM related libraries that this build doesn't need.
// The application can manage this manually by setting 'enableVmCleanup: false'
//
// This should really be done by packaging all Hermes releated libs into
// two separate HermesDebug and HermesRelease AARs, but until then we'll
// kludge it by deleting the .so files out of the /transforms/ directory.
def isRelease = !targetName.toLowerCase().contains("debug")

Also added a quick fix for #25609

ant.move(
    file: jsBundleFile,
    tofile: "${jsBundleFile}_temp"
);
commandLine(getHermesCommand(), "-emit-binary", "-out", jsBundleFile, "${jsBundleFile}_temp", *hermesFlags)

@dov11
Copy link

dov11 commented Jul 12, 2019

In my case I saw this crash when:

  1. I first build release with enableHermes: false
  2. Change enableHermes: true
  3. Build release

all while

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

and

if (enableHermes) {
    def hermesPath = "../../node_modules/hermesvm/android/";
    debugImplementation files(hermesPath + "hermes-debug.aar")
    releaseImplementation files(hermesPath + "hermes-release.aar")
  } else {
    implementation jscFlavor
  }

were present.

Crash disappears after cleaning the build:
cd android && ./gradlew clean

@Villar74
Copy link

Villar74 commented Jul 12, 2019

@dov11 cleaning build doesn't help with that for me
P.S. I want to use hermes, so i set it to true

@qadratic
Copy link

I, following the guide set enableHermes to true but cant see any global variable named HermesInternal.

@kelset kelset added the Platform: Android Android applications. label Jul 13, 2019
@AbanoubNassem
Copy link

same issue here it builds fine but crashes on start up

@Jalson1982
Copy link

Same issue after setting:
project.ext.react = [
entryFile: "index.js",
enableHermes: true // clean and rebuild if changing
]
App build fine but crash on startup :

Fatal Exception: java.lang.UnsatisfiedLinkError
com.facebook.soloader.SoLoader.doLoadLibraryBySoName

@Kennytian
Copy link

couldn't find DSO to load: libhermes.so

--------- beginning of crash
2019-07-14 09:44:01.739 11565-12396/com.rn0602 E/AndroidRuntime: FATAL EXCEPTION: create_react_context
    Process: com.rn0602, PID: 11565
    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:919)
2019-07-14 09:44:01.914 2015-2015/? E/Layer: [Surface(name=AppWindowToken{5d867f6 token=Token{70d7c91 ActivityRecord{8ebe6b8 u0 com.rn0602/.MainActivity t22}}})/@0x7826de8 - animation-leash#0] No local sync point found
2019-07-14 09:44:01.914 2015-2015/? E/Layer: [Surface(name=AppWindowToken{683f3c9 token=Token{99157d0 ActivityRecord{3bb3b93 u0 com.google.android.apps.nexuslauncher/.NexusLauncherActivity t5}}})/@0x69d81a9 - animation-leash#0] No local sync point found
2019-07-14 09:44:12.219 2249-2281/system_process E/memtrack: Couldn't load memtrack module
2019-07-14 09:44:12.224 2249-2281/system_process E/memtrack: Couldn't load memtrack module
2019-07-14 09:44:12.230 2249-2281/system_process E/memtrack: Couldn't load memtrack module
2019-07-14 09:44:23.112 2154-2154/? E/netmgr: Failed to open QEMU pipe 'qemud:network': Invalid argument
2019-07-14 09:44:23.113 2154-2154/? E/netmgr: WifiForwarder unable to open QEMU pipe: Invalid argument
2019-07-14 09:44:38.328 2249-2281/system_process E/memtrack: Couldn't load memtrack module

@vodanh109
Copy link

Same issues

@bhaskarGyan
Copy link
Author

  if (enableHermes) {
    def hermesPath = "../../node_modules/hermesvm/android/";
    debugImplementation files(hermesPath + "hermes-debug.aar")
    releaseImplementation files(hermesPath + "hermes-release.aar")
  } else {

// @benoitdion where are we initialising the variable jscFlavor?

implementation jscFlavor

}


in your dependencies.

Should we move those bits of configuration to `react.gradle`?

@benoitdion, If possible then Yes please since I believe user should not be worried about these kind of one time configuration. It would be great if these bits of config move to react.gradle

@chubillkelvin
Copy link

Same problem here, using RN 0.60.3.

I followed this (https://react-native-community.github.io/upgrade-helper/?from=0.59.9&to=0.60.3) to upgrade my app from RN 0.59.9 to 0.60.3 and have added all the necessary configs for Android from there.

The app runs normally when Hermes is not enabled. However, once Hermes is enabled by following the step here (https://facebook.github.io/react-native/docs/hermes), the app can build, can start up and show the splash screen - but crashes immediately after the splash screen is done. Couldn't find any solution yet. Hope this provides a bit of extra information needed to debug this.

@rafaumlemos
Copy link

Same issue here.

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so

@vijayhfs
Copy link

this worked for me: https://stackoverflow.com/questions/56734877/getting-library-libjsc-so-not-found-after-upgrading-react-native-to-0-60-rc2

I am also facing the the same issue. Can you please explain this in details if this worked for you to resolve Hermes issue.

@mjmasn
Copy link
Contributor

mjmasn commented Jul 15, 2019

@yjkimjunior @vijayhfs that's a different issue with libjsc, nothing to do with this Hermes issue.

The solution is in these two comments:
#25601 (comment)
#25601 (comment)

The important thing is that upgrading React Native is not (usually) simply a case of updating the version number in package.json. Use https://react-native-community.github.io/upgrade-helper/ to see which files need to be modified between two versions, or use the react-native upgrade command.

@bhaskarGyan
Copy link
Author

The solution is in these two comments:
#25601 (comment)

@mjmasn I am getting below error using above solution

Error :

  • What went wrong:
    Execution failed for task ':app:preReleaseBuild'.

Could not resolve all files for configuration ':app:releaseCompileClasspath'.
Failed to transform file 'hermes-release.aar' to match attributes {artifactType=android-manifest}
> Execution failed for JetifyTransform: /Users/../node_modules/hermesvm/android/hermes-release.aar.
> Failed to transform '/Users/.../reactNativeMemoryProfile/node_modules/hermesvm/android/hermes-release.aar' using Jetifier. Reason: Cannot open a library at 'FileMapping(from=/Users/.../reactNativeMemoryProfile/node_modules/hermesvm/android/hermes-release.aar, to=/Users/.../.gradle/caches/transforms-2/files-2.1/1f2be632de94c0fe0ca58b3163f651c8/jetified-hermes-release.aar)'.

@bradbyte
Copy link

I had the exact same issue, with none of the steps above working. I eventually realized that when I ran npx react-native upgrade I had some conflicts that never made it to the diff. By examining rn-diff-purge I was able to apply the manual updates needed to my build.gradle files, gradle-wrapper, and other android areas. It now works as expected!

@bhaskarGyan
Copy link
Author

It is now working.
Problem: I made a mistake not to refer to https://github.com/react-native-community/rn-diff-purge/compare/release%2F0.60.0..release%2F0.60.3?diff=split while upgrading the App from 0.60.0 to 0.60.3.

After modification of relevent file mentioned in above url and cd android && ./gradlew clean, the app is working as expected with Hermes enabled.

Link to commit in my repo for these changes -> bhaskarGyan/react-native-memory-profile@3d05ebc

@vodanh109
Copy link

@bhaskarGyan
I init project from react native cli, with version 0.60.3, and still meet the problem with couldn't find DSO to load: libhermes.so

Any clue for that?

Thanks

@bhaskarGyan
Copy link
Author

@vodanh109 , is it even after ./gradlew clean?

can you share sample project github url?

@vodanh109
Copy link

@bhaskarGyan yeap, even after ./gradlew clean, still crashed after starting up. I just use the initial project, no more change

@vodanh109
Copy link

vodanh109 commented Jul 16, 2019

I think I passed this issue, via ./gradlew clean, but now I have problem same as #25599 when run with --variant release

@IamMasterWayne
Copy link

+1

@lucadruda
Copy link

I got the same error (couldn't find DSO to load: libhermes.so) even with hermes disabled and
without changing any gradle file apparently.
After looking at the logcat I saw the initial error few lines above:

dlopen failed: library "libjsc.so" not found

and I guess the hermes error happens because of the fallback.
Then after double check my gradle files I found the issue (at least for me)

I had this in my root build.gradle:

maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
            url("https://jitpack.io")
        }

where I added jitpack because of a 3rd party library requirement.

After changing to this (separate blocks):

maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
maven {
             url("https://jitpack.io")
        }

The issue is gone and app doesn't crash anymore. So it looks like build succeeds but resulting APK doesn't contain the right 'jsc' libraries, probably because download fails in the maven directive (don't have a real explanation btw).

@Ansonmathew
Copy link

Install Hermes Engine.
NPM

@norbertsongin
Copy link

norbertsongin commented Oct 11, 2019

In react.gradle there are checks like this:

targetName.toLowerCase().contains("release")

So I've decided to just rename my custom target name from alpha to alphaRelease.

@mwss1996
Copy link

In my case I had "hermes-engine" folder instead of "hermesvm" under node_modules so when I changed the folder name to hermes-engine in the app's build.gradle the error was gone (my RN version is 0.61.0)

on RN 0.61.1 this problem seems resolved so i would suggest upgrading your RN version.

This worked for me!

@singhamitkumar
Copy link

After enabling Hermes in your project, Please update the Hermes path in "android/app/build.gradle" file. You can see the sample code below.

if (enableHermes) {
      def hermesPath = "../../node_modules/hermes-engine/android/";
      debugImplementation files(hermesPath + "hermes-debug.aar")
      releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
      implementation jscFlavor
    }

After the update of hermesPath, run your application react-native run-android. Hermes issue has been fixed.

@Yushenbo
Copy link

@SourceCipher Yes, it works, these are the bits from my app/build.gradle

project.ext.react = [
    entryFile: "index.android.js",
    enableHermes: false
]

def enableHermes = project.ext.react.get("enableHermes", false);
def jscFlavor = 'org.webkit:android-jsc:+'
def safeExtGet(prop, fallback) {
    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

// ... later on ....

dependencies {
    // ....
    if (enableHermes) {
        def hermesPath = "../../node_modules/hermesvm/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
    // ....
}

After that, though I ran into red screen issues connecting to 10.0.2.2:8081, which I solved by modifying AndroidManifest.xml:

<application
     android:usesCleartextTraffic="true"
     ....

hi I follow yours modifications, but there will be a Error "libjsexecutor.so not found", and add this #25537 (comment) modification, app works fine

@juicycleff
Copy link

juicycleff commented Oct 21, 2019

Should be this as of RN 0.60.4

dependencies {
    // ....
    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
    // ....
}

@SourceCipher
Copy link

@juicycleff I can confirm that this works with RN 0.61.2 as well.

@bitsmanent
Copy link

bitsmanent commented Oct 31, 2019

Thanks @aliozinan !

I'm on RN 0.61.2 and fixed by replacing hermesvm with hermes-engine in android/app/build.gradle, like this:

def hermesPath = "../../node_modules/hermes-engine/android/";

Now everything works properly.

@roots-ai
Copy link

roots-ai commented Nov 5, 2019

In my case I had "hermes-engine" folder instead of "hermesvm" under node_modules so when I changed the folder name to hermes-engine in the app's build.gradle the error was gone (my RN version is 0.61.0)

on RN 0.61.1 this problem seems resolved so i would suggest upgrading your RN version.

Doesn't work.

#27116

@aliozinan
Copy link

aliozinan commented Nov 5, 2019

In my case I had "hermes-engine" folder instead of "hermesvm" under node_modules so when I changed the folder name to hermes-engine in the app's build.gradle the error was gone (my RN version is 0.61.0)
on RN 0.61.1 this problem seems resolved so i would suggest upgrading your RN version.

Doesn't work.

The error you're getting is clearly telling you that a property was being set multiple times in the object definition during the build process.

This issue is about enabling Hermes Engine and building the project successfully by resolving the "DSO not found" error, hence your issue is not related to this one and should be investigated seperately.

So as a result, my solution actually works for the related issue being this one.

Try with 0.60.0 or 0.61.1 versions, apply the solution recommended in the above messages and check if you're able to get a successful build. If you get "DSO not found" error, report here. Finally, remove the reference in your message here to the issue you opened, it's a wrong reference.

@MarcoF09
Copy link

In my side the problem was fixed when I run 'Clean project' and then run again.

@Iamniks4
Copy link

In my case I saw this crash when:

  1. I first build release with enableHermes: false
  2. Change enableHermes: true
  3. Build release

all while

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

and

if (enableHermes) {
    def hermesPath = "../../node_modules/hermesvm/android/";
    debugImplementation files(hermesPath + "hermes-debug.aar")
    releaseImplementation files(hermesPath + "hermes-release.aar")
  } else {
    implementation jscFlavor
  }

were present.

Crash disappears after cleaning the build:
cd android && ./gradlew clean

i did the same thing, alongwith "def enableProguardInReleaseBuilds = false" in the same file,
but when i pushed my app bundle to play store it is crashing on startup.

@nokite
Copy link

nokite commented Mar 9, 2020

For people with more build types (let's call it anotherDebug):


// In dependencies {}:
    debugImplementation files(hermesPath + "hermes-debug.aar")
    anotherDebugImplementation files(hermesPath + "hermes-debug.aar")
    releaseImplementation files(hermesPath + "hermes-release.aar")

// This is where the build types are specified (in buildTypes {}):
        anotherDebug {
            initWith buildTypes.debug
            matchingFallbacks = ['debug'] // For libs that don't have this build type
            // Add stuff that makes anotherDebug necessary for you
        }

@maitrungduc1410
Copy link

maitrungduc1410 commented Apr 1, 2020

For anyone having this issue, this may help.

From React native docs:

Note about Android App Bundles
Android app bundles are not yet supported with hermes

That means Hermes is only for .apk. I was really had a headache because my release .aab stucks on splash screen 🤣

Hope this help

Update: Hermes is now supported since RN 0.62 and up

@SudoPlz
Copy link
Contributor

SudoPlz commented Jul 29, 2020

@maitrungduc1410 oh my god, I've been banging my head on the wall for hours with that.

That being said, it now says:

Android app bundles are supported from react-native 0.62.0 and up. so 0.63.2 shouldn't be affected.

@StebanDev
Copy link

For people with more build types (let's call it anotherDebug):


// In dependencies {}:
    debugImplementation files(hermesPath + "hermes-debug.aar")
    anotherDebugImplementation files(hermesPath + "hermes-debug.aar")
    releaseImplementation files(hermesPath + "hermes-release.aar")

// This is where the build types are specified (in buildTypes {}):
        anotherDebug {
            initWith buildTypes.debug
            matchingFallbacks = ['debug'] // For libs that don't have this build type
            // Add stuff that makes anotherDebug necessary for you
        }

This solved my issue, thank you @nokite .

@77TecShaeer
Copy link

+++

@Sheharyar566
Copy link

Sheharyar566 commented Apr 22, 2021

I don't have any more than the already present build types, but I did add product flavors and here's my build.gradle... And it is crashing without giving any logs

apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
    entryFile: "index.js",
    enableHermes: true
]

apply from: '../../node_modules/react-native-unimodules/gradle.groovy'
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/expo-updates/scripts/create-manifest-android.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = true

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.coolconnect.pax"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 7
        versionName "1.0.7"
        manifestPlaceholders = [appAuthRedirectScheme: 'com.coolconnect.pax']
        resConfigs "en", "es"
    }
    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://reactnative.dev/docs/signed-apk-android.
            signingConfig signingConfigs.debug
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            shrinkResources true
        }
    }

    flavorDimensions "Default"

    productFlavors {
        TaxisPlus {
            applicationId 'com.taxisplus.pax'
        }
        CoolConnect {
        }
    }

    // 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
            }

        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation "com.android.support:appcompat-v7:23.0.1"
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
    implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
    implementation 'com.google.firebase:firebase-core:16.0.7'
    
    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.fbjni'
    }
    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
        exclude group:'com.squareup.okhttp3', module:'okhttp'
    }
    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }
    addUnimodulesDependencies()

    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'

@77TecShaeer
Copy link

77TecShaeer commented Apr 22, 2021 via email

@Sheharyar566
Copy link

android/app/build.gradle @77TecShaeer

@facebook facebook locked as resolved and limited conversation to collaborators Oct 9, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests