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

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

Closed
LydGol90 opened this issue Aug 29, 2019 · 11 comments
Closed

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

LydGol90 opened this issue Aug 29, 2019 · 11 comments
Labels
Bug Stale There has been a lack of activity on this issue and it may be closed soon. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.

Comments

@LydGol90
Copy link

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!

@asleepace
Copy link

Similar issue for us with 0.60.5 and Hermes enabled, except it would build but then hang on launch on certain devices (we suspect 32-Bit). Then when we disabled Hermes it would build, but then crash saying that the index.android.bundle file wasn't included properly.

@LydGol90
Copy link
Author

@asleepace, so have you been able to get it to build using the -P flag to pass in the signing properties?

@asleepace
Copy link

asleepace commented Aug 30, 2019

@LydGol90 we haven't been using the -P flag, we use app signing by Google: https://support.google.com/googleplay/android-developer/answer/7384423

as a side note running ./gradlew assembleRelease works for us, but the binary is 2x the size...

@LydGol90
Copy link
Author

LydGol90 commented 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.

@anmol-appzoy
Copy link

Hi @LydGol90, I tried using the solution that you described here #15233 (comment) but that didn't work for me, getting an invalid command error. Can you please elaborate the process and it will be really helpful if you can upload the files that need the changes here.
Thanks

@LydGol90
Copy link
Author

LydGol90 commented 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!

@leonardo2204
Copy link

How are you guys bypassing the ./gradlew bundleRelase freezing bug?
If I compile with assembleRelease I get an error in the Play Store saying that my apk is not both x86 and x64.
Any ideas?

Thanks

@stale
Copy link

stale bot commented Dec 10, 2019

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 Dec 10, 2019
@RemyLivewall
Copy link

We are seeing the same issue when using a CI. The fix LydGol90 mentioned also work for us, we are running on React Native 0.61.3.

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Dec 17, 2019
@stale
Copy link

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

stale bot commented May 23, 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 May 23, 2020
@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2020
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. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.
Projects
None yet
Development

No branches or pull requests

6 participants