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.61.2] Hermes does not support custom variants #27829

Closed
jacob-israel-turner opened this issue Jan 21, 2020 · 8 comments
Closed

[0.61.2] Hermes does not support custom variants #27829

jacob-israel-turner opened this issue Jan 21, 2020 · 8 comments
Labels
Bug Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@jacob-israel-turner
Copy link
Contributor

jacob-israel-turner commented Jan 21, 2020

The logic in react.gradle relies on the variant name to contain release in order for Hermes to build properly.

Source 1 Source 2

In my case, I had a variant called staging. In order for hermes to work for me, I had to rename my variant to releasestaging. Instead, we should be able to pass required options in through app/build.gradle, without having to rename the variant.

React Native version:

System:
OS: macOS Mojave 10.14.6
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 2.35 GB / 32.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.18.1 - ~/.nvm/versions/node/v10.18.1/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.13.4 - ~/.nvm/versions/node/v10.18.1/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 23, 26, 27, 28, 29
Build Tools: 27.0.3, 28.0.3, 29.0.2
System Images: android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5791312
Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.2 => 0.61.2

Steps To Reproduce

  1. Create new React Native project
  2. Create custom variant that does not include release in its name
  3. Enable hermes
  4. Build to device and see error when launching app:
couldn't find DSO to load: libhermes-executor-debug.so caused by: dlopen failed: cannot locate symbol "_ZTIN8facebook6hermes8debugger13EventObserverE" referenced by "/data/app/com.freeplay-q767SRYD9UinoTtLFqtR4Q==/lib/arm64/libhermes-inspector.so"...

Describe what you expected to happen:
Expect to build to device and the app to run successfully with Hermes enabled.

Snack, code example, screenshot, or link to a repository:
Example failing android/app/build.gradle. Replacing staging with releasestaging fixes the issue.

Related issue.

@mhorowitz
Copy link
Contributor

The gradle hacks you refer to are also causing issues with hermes and the android gradle plugin v3.5. I'm not a gradle expert (I find their patterns hard to work with), but I think I've worked out how to improve this. But, it will take a few weeks for me to get to it. Stay tuned.

@ajiagahari
Copy link

ajiagahari commented Mar 12, 2020

you need to add custom implementation on your '/app/build.gradle'

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

'staginImplementaion' matches 'applicationIdSuffix' or 'buildTypes' on build config, im not sure, because my bad understanding in English, in my case I use same text on 'applicationIdSuffix' and 'buildTypes' so it works either way
as its mention here

https://developer.android.com/studio/build/dependencies#dependency_configurations

@dougkeen
Copy link

Alternatively, where there are targetName.toLowerCase().contains("release") checks, the gradle file could also honor the config."devDisabledIn${targetName}" setting.

@stale
Copy link

stale bot commented Jun 12, 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 Jun 12, 2020
@eliaslecomte
Copy link

This is still a problem in 62.2.

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Jun 15, 2020
@mhorowitz
Copy link
Contributor

I tried to make this work better, but I wasn't able to. If someone who is better at gradle than I am can submit a PR to improve this, that would be really helpful.

@stale
Copy link

stale bot commented Sep 13, 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 Sep 13, 2020
@stale
Copy link

stale bot commented Oct 4, 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 Oct 4, 2020
@facebook facebook locked as resolved and limited conversation to collaborators Oct 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug 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

5 participants