question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

Passing --sourcemap-output to extraPackagerArgs fails to build.

See original GitHub issue

šŸ› Bug Report

I want to generate sourcemaps when running ./gradlew assembleRelease.

I looked into react.gradle and saw that it accepts extraPackagerArgs and passes that to the bundle command.

So I tried passing the --sourcemap-output option in my build.gradle like so:

project.ext.react = [
  extraPackagerArgs: [ "--sourcemap-output", "$buildDir/intermediates/assets/release/index.android.bundle.map" ]
]

But I get the following error when running ./gradlew assembleRelease:

> Task :cntral:bundleReleaseJsAndAssets FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Failed to capture fingerprint of input files for task ':cntral:bundleReleaseJsAndAssets' property '$1' during up-to-date check.
> Failed to create MD5 hash for file '/Users/me/Development/app/tmp/skylight-87084.sock' as it does not exist.

To Reproduce

See above.

Expected Behavior

Generates an APK as well as the sourcemaps.

Environment

$ ./node_modules/.bin/react-native info

  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: (24) x64 Intel(R) Xeon(R) CPU           X5690  @ 3.47GHz
      Memory: 7.96 GB / 64.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.11.0 - /usr/local/bin/node
      Yarn: 1.10.1 - /usr/local/bin/yarn
      npm: 6.4.1 - /usr/local/bin/npm
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 15, 17, 22, 23, 27, 28
        Build Tools: 26.0.0, 28.0.3
        System Images: android-22 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
    IDEs:
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.3 => 16.6.3 
      react-native: 0.57.8 => 0.57.8 

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
joshuapintercommented, Mar 21, 2019

An update for you. I moved the extraPackagerArgs from the app/build.gradle to the root projectā€™s build.gradle file with:

ext {
  react = [
    extraPackagerArgs: [ "--sourcemap-output", "app/build/generated/assets/react/release/index.android.bundle.map" ] // Needed for Bugsnag to decode minimized Javascript.
  ]
}

And it worked fine. So it had to do with trying to add the ext variables in the appā€™s build.gradle.

Anyway, doesnā€™t seem related to react-native so Iā€™m going to close this Issue.

Thanks for looking at it regardless. šŸ‘

0reactions
joshuapintercommented, Mar 20, 2019

Weird. So I deleted that .sock file and re-ran. Now Iā€™m getting the following error:

> Task :cntral:bundleReleaseJsAndAssets FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Failed to capture fingerprint of input files for task ':cntral:bundleReleaseJsAndAssets' property '$1' during up-to-date check.
> Could not list contents of '/Users/me/Development/ntwrk/node_modules/.bin/extract-zip'. Couldn't follow symbolic link.

So, ntwrk is a completely different project. Not related to the project Iā€™m working on at all. Whatā€™s going on that itā€™s looking at these files?

And, to confirm, if I just manually update the react.gradle file and change the following:

"--reset-cache", "--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir, *extraArgs)

to

"--reset-cache", "--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir, "--sourcemap-output", "./app/build/generated/assets/react/release/index.android.bundle.map", *extraArgs)

It works fine and the sourcemaps are generated.

Itā€™s just trying to add the extraPackagerArgs that causes these errors. So youā€™re right, in that, itā€™s not --sourcemap-output related, but instead extraPackagerArgs or project.ext.react related.

Anything else I can try to help diagnose?

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android gradlew assembleRelease --sourcemap output fail ...
In './android/app/build.gradle', I have the extraPackagerArgs property to generate source maps. project.ext.react = [ entryFile: "Ā ...
Read more >
react native convert meaningless stack trace to original source ...
To generate a source map in react native for IOS, run this command, and the source map will be generated at the root...
Read more >
How to add sourcemap in React Native for Production?-Reactjs
ios --sourcemap-output ./sourcemap.js. Android - I had to actually modify the android/app/react.gradle file to get source maps generating on release compile ...
Read more >
Inspect React Native App Crash with Source Map - Wade Huang
You can pass --sourcemap-output to change the output path. If your project uses CI/CD to build and distribute the app, it is recommended...
Read more >
Source Maps - React Native
... into an error in the release build you will see a stacktrace like: ... Writing sourcemap output to:, android/app/build/intermediates/Ā ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found