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.

./gradlew bundleRelease not working with -P in React Native 0.60.5

See original GitHub issue

Hi there!

On React Native 0.60.5 the ./gradlew bundleRelease command has stopped working when signing config properties are provided wit the -P flag.

Without -P:

➜  android ./gradlew bundleRelease

> Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
Loading dependency graph, done.
info Writing bundle output to:, /Users/lydiagolland/Projects/tets/android/app/build/generated/assets/react/release/index.android.bundle
info Writing sourcemap output to:, /Users/lydiagolland/Projects/tets/android/app/build/generated/sourcemaps/react/release/index.android.bundle.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 2 asset files
info Done copying assets

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 SUCCESSFUL in 1m 0s
33 actionable tasks: 33 executed

With -P

➜  android ./gradlew bundleRelease -Pandroid.injected.signing.store.file='debug.keystore' -Pandroid.injected.signing.store.password='android' -Pandroid.injected.signing.key.alias='androiddebugkey' -Pandroid.injected.signing.key.password='android'
> Task :app:validateSigningRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file '/Users/lydiagolland/Projects/tets/android/debug.keystore' not found for signing config 'externalOverride'.

* 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

React Native version:

System:
    OS: macOS 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
    Memory: 523.11 MB / 8.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 12.6.0 - ~/.nvm/versions/node/v12.6.0/bin/node
    Yarn: 1.17.3 - ~/.nvm/versions/node/v12.6.0/bin/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v12.6.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
    Android SDK:
      API Levels: 23, 28, 29
      Build Tools: 28.0.2, 28.0.3, 29.0.1
      System Images: android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5692245
    Xcode: 10.3/10G8 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6
    react-native: 0.60.5 => 0.60.5
  npmGlobalPackages:
    react-native-cli: 2.0.1

Steps To Reproduce

  1. react-native init
  2. Comment out signingConfig signingConfigs.debug from release buildType
  3. cd android && ./gradlew bundleRelease -Pandroid.injected.signing.store.file='app/debug.keystore' -Pandroid.injected.signing.store.password='android' -Pandroid.injected.signing.key.alias='androiddebugkey' -Pandroid.injected.signing.key.password='android'

Describe what you expected to happen: It to build successfully as it does with ./gradlew bundleRelease when signing config is provided in the build gradle.

Fastlane uses the -P flag in its build_android lane and so this is currently preventing people from being able to automatically handle signing in fastlane for android builds.

Thanks in advance for any help!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:11

github_iconTop GitHub Comments

2reactions
LydGol90commented, Sep 11, 2019

Hi @anmol-appzoy. Not sure the link you put in is correct as it leads to a totally different issue? As for my current solution to this issue.

In my app/build.gradle

    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_PASSWORD')) {
                storeFile file('../keystores/release.keystore')
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }

Then in before I run ./gradlew bundleRelease I set the three variables MYAPP_RELEASE_STORE_PASSWORD, MYAPP_RELEASE_KEY_ALIAS and MYAPP_RELEASE_KEY_PASSWORD in my gradle.properties file. Locally I just copy paste them in as needed and when running in ci I have them set as secret environment variables and simply echo them into my gradle.properties file before I build.

      - run:
          name: Set store password
          working_directory: android
          command: echo "MYAPP_RELEASE_STORE_PASSWORD=$ANDROID_STORE_PASSWORD" >> gradle.properties

      - run:
          name: Set key alias
          working_directory: android
          command: echo "MYAPP_RELEASE_KEY_ALIAS=$ANDROID_KEY_ALIAS" >> gradle.properties

      - run:
          name: Set key password
          working_directory: android
          command: echo "MYAPP_RELEASE_KEY_PASSWORD=$ANDROID_KEY_PASSWORD" >> gradle.properties

You can still run fastlane lane but just with this:

    gradle(
      task: 'bundle',
      build_type: 'Release',
    )

Hope this helps!

1reaction
LydGol90commented, Sep 2, 2019

@Asleepace Yeah ./gradlew assembleBundle and ./gradlew assembleRelease both work for me, it only fails when I use the -P flag to pass in the signing properties. We use fastlane to build our android app in CI and fastlane uses the -P flag behind the scenes in its build_android_app lane so, although we are not blocked from building our app entirely, we are blocked from using fastlane in the most straightforward way.

Read more comments on GitHub >

github_iconTop Results From Across the Web

2 Answers - 2 - Stack Overflow
gradlew assembleRelease -x bundleReleaseJsAndAssets. if this fails: in root of project: react-native bundle --platform android --dev false -- ...
Read more >
Test Renderer - React
This package provides a React renderer that can be used to render React components to pure JavaScript objects, without depending on the DOM...
Read more >
React Native - Sentry Documentation
Sentry's React Native SDK enables automatic reporting of errors and exceptions, and identifies performance issues in your application. The React Native SDK ...
Read more >
Configure multiple flavor/schema for React Native Apps
So, We will divide this tutorial in two parts Android and iOS. Android. Note: Once you add Product Flavors to your app, you...
Read more >
Getting Started with React Native on Android | Pluralsight
Note : Homebrew installation requires the xcode-select command-line tool to work so it's recommended to install Xcode as well or it will ask...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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