Skip to content

[Android] Upgrade of CLI from 3.x to 4.x (with RN 0.62) breaks --appIdSuffix #1085

Closed

Description

@cbrevik

Environment

System:
    OS: macOS 10.15.3
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 594.50 MB / 32.00 GB
    Shell: 3.1.0 - /usr/local/bin/fish
  Binaries:
    Node: 10.16.3 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.0 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-29 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5977832
    Xcode: 11.3/11C29 - /usr/bin/xcodebuild
  Languages:
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0
    react-native: 0.62.0 => 0.62.0
  npmGlobalPackages:
    *react-native*: Not Found

Description

We're using an applicationIdSuffix in our apps gradle file for debug, which we run with npx react-native run-android --appIdSuffix debug

    buildTypes {
        debug {
            applicationIdSuffix ".debug"
            signingConfig signingConfigs.debug
        }
    }

This has worked thus far with the CLI v3.x, but as we upgraded our project to React Native 0.62.0, the CLI was upgraded to v4.4.

Now we're getting the following error when the app builds, running the same command:

$ react-native run-android --appIdSuffix debug
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1976 file(s) to forward-jetify. Using 16 workers...
info JS server already running.
info Installing the app...

<snip>

FAILURE: Build failed with an exception.

* What went wrong:
Task 'installDebugDebug' not found in project ':app'.

Reproducible Demo

Sample project: https://github.com/cbrevik/suffixExample

Note: I've just generated a 0.62 project with npx react-native init, and added an extra commit on top of that with applicationIdSuffix: cbrevik/suffixExample@d6129ec

Activity

  1. added
    bug
    and removed on Mar 31, 2020
  2. thymikee commented on Mar 31, 2020

    @thymikee
    Member

    Thanks for the repro, we'll try to prioritize this. I suspect these might be commits that introduced this regression: #1029, #1053. Any help with debugging this and contributing a fix is greatly appreciated 😊

  3. added a commit that references this issue on Mar 31, 2020
  4. cbrevik commented on Mar 31, 2020

    @cbrevik
    ContributorAuthor

    Sure! This seems like the bug: 19ac71f#diff-b668aefc66b33ed6e984d3467db0abc1R54 (concat appIdSuffix to variant in order to generate the task name).

    The workaround for me was to just overwrite the task name, with:

    react-native run-android --tasks installDebug --appIdSuffix debug

    Even though that works, it seems like the options should work in a different way.

    As far as I understand, a build variant in Android is the full name of the build type with the flavor. So for example the build type could be debug, while the flavor could be demo, which makes the build variant demoDebug. I'm not an expert at gradle though, so 🤷‍♂

    In this case, the appIdSuffix should only be used when launching the app, not when building it. I think the appIdSuffix doesn't have to be the same as the build type, so concatenating the suffix + variant probably isn't a good idea?

    So maybe it's better if people specify the "full" variant name to build with --variant while --appIdSuffix only helps the CLI launch the correct package.

    I've commited a fix here; AtB-AS@bd297f4

    I'd love to open a PR in this case, if it seems like the right solution.

  5. thymikee commented on Mar 31, 2020

    @thymikee
    Member

    @krizzu what do you think? ^

  6. krizzu commented on Mar 31, 2020

    @krizzu
    Member

    I agree that CLI params naming are bit misleading here, so I'm up for the change.

  7. added a commit that references this issue on Mar 31, 2020
  8. Esemesek commented on Apr 5, 2020

    @Esemesek
    Member

    Fixed in #1087

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds triageplatform: android

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions