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

Hermes With Inline-Require Conflict RN-60.4 (When Generate Release Apk) #25754

Closed
Navidhp opened this issue Jul 21, 2019 · 10 comments
Closed

Hermes With Inline-Require Conflict RN-60.4 (When Generate Release Apk) #25754

Navidhp opened this issue Jul 21, 2019 · 10 comments
Labels
Bug Resolution: Locked This issue was locked by the bot.

Comments

@Navidhp
Copy link

Navidhp commented Jul 21, 2019

i upgrade from 59.8 to 60.4 and now i want to generate apk release when run ./gradlew assembleRelease and enable Hermes and enable inline reqiure to happen :

React Native version:

    OS: macOS High Sierra 10.13.6
    CPU: (4) x64 Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz
    Memory: 1.03 GB / 12.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 11.13.0 - /usr/local/bin/node
    Yarn: 1.15.2 - /usr/local/bin/yarn
    npm: 6.7.0 - /usr/local/bin/npm
  SDKs:
    iOS SDK:
      Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
    Android SDK:
      API Levels: 23, 26, 27, 28
      Build Tools: 23.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.2, 28.0.3
      System Images: android-23 | Google APIs Intel x86 Atom, 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
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5522156
    Xcode: 10.1/10B61 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.4 => 0.60.4`

Steps To Reproduce

1- cd android && ./gradlew assembleRelease

info Writing bundle output to:, /Users/iSafir/Desktop/novinCinema/android/app/build/generated/assets/react/release/index.android.bundle
info Writing sourcemap output to:, /Users/iSafir/Desktop/novinCinema/android/app/build/intermediates/sourcemaps/react/release/index.android.bundle.packager.map
info Done writing sourcemap output
info Done writing unbundle output
info Copying 299 asset files
info Done copying assets
/Users/iSafir/Desktop/novinCinema/node_modules/react-native/scripts/compose-source-maps.js:41
    throw new Error(
    ^

Error: Random Access Bundle (RAM) format is not supported by this tool; it cannot process the `x_facebook_offsets` field provided in the base and/or target source map(s)
    at Object.<anonymous> (/Users/iSafir/Desktop/novinCinema/node_modules/react-native/scripts/compose-source-maps.js:41:11)
    at Module._compile (internal/modules/cjs/loader.js:805:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:816:10)
    at Module.load (internal/modules/cjs/loader.js:672:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:612:12)
    at Function.Module._load (internal/modules/cjs/loader.js:604:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:868:12)
    at internal/main/run_main_module.js:21:11

> Task :app:bundleReleaseJsAndAssets FAILED

FAILURE: Build failed with an exception.

* Where:
Script '/Users/iSafir/Desktop/novinCinema/node_modules/react-native/react.gradle' line: 160

* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command 'node'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1m 51s

metro.config.js

  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: true,
      },
    }),
  },
};

app/build.gradle

project.ext.react = [
    entryFile: "index.js",
    bundleCommand: "ram-bundle",
    bundleConfig: "./metro.config.js",
    enableHermes: true
]

android/gradle.properties

android.useAndroidX=true
android.enableJetifier=true
@Navidhp Navidhp added the Bug label Jul 21, 2019
@Navidhp Navidhp changed the title Hermes With Inline-Require Conflict RN-60.4 (When Apk Release) Hermes With Inline-Require Conflict RN-60.4 (When Generate Release Apk) Jul 21, 2019
@chubillkelvin
Copy link

Have you installed jetifier and done jetify (also enable jetify inside config) before running the release? I was having a similar (not exactly the same) problem with the message Execution failed for task ':app:bundleReleaseJsAndAssets'. and this solved it for me.

@Navidhp
Copy link
Author

Navidhp commented Jul 22, 2019

@RageBill yes i installed jetifier and run jetify , i don't think has connection to andoridX

@AlithAnar
Copy link

Same error here, with the same config and react-native 0.60.4.

@Navidhp
Copy link
Author

Navidhp commented Jul 23, 2019

i found this in code fb :

Lazy compilation
Iteration speed is one of the main benefits of a JavaScript-based platform, but compiling bytecode in advance would chip away at this advantage. To keep reloads fast, Hermes debug builds don’t use ahead-of-time compilation; instead, they generate bytecode lazily on device. This allows for rapid iteration using Metro or another source of plain JavaScript code to run. The trade-off is that lazy-compiled bytecode does not include all the optimizations of a production build. In practice, although we can measure the difference in performance, we have found this approach is sufficient to provide a good developer experience without affecting production metrics.
resource : https://code.fb.com/android/hermes/

@wmonecke
Copy link

wmonecke commented Aug 6, 2019

Any news on this? I have been dealing with this for a while now...

@Navidhp
Copy link
Author

Navidhp commented Aug 6, 2019

@wmonecke inline require is oky but ram-bundle not supported by hermes

@Navidhp
Copy link
Author

Navidhp commented Aug 24, 2019

any news ??

@fonov
Copy link

fonov commented Sep 4, 2019

Note: If you are using Hermes JS Engine, you do not need RAM bundles. When loading the bytecode, mmap ensures that the entire file is not loaded.

https://facebook.github.io/react-native/docs/performance#enable-the-ram-format

@fonov
Copy link

fonov commented Sep 4, 2019

just delete bundleCommand: "ram-bundle", from app/build.gradle

@Navidhp
Copy link
Author

Navidhp commented Sep 10, 2019

fixed we don't needed ram-bundle with hermes

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

No branches or pull requests

6 participants