Skip to content

--mode vs (deprecated) --variant flag - clarity required #2288

Closed

Description

@aljidy

Ask your Question

In the #2026 PR, the deprecated variant flag was swapped out for mode. Looking at the code in the pr, it looks like they effectively do the same thing on Android and pass the buildVariant into Gradle to get the relevant Gradle task.

However the docs/help seem to imply they don't work the same.

--variant Specify your app's build variant.

Whereas:

--mode Mode to build the app. Either 'debug' (default) or 'release'.

Seems to imply it can only be debug or release, and not a buildVariant string.

Could I get some clarity on this?

Feel like either: @cortinico or @szymonrybczak might be best placed to answer this.

Many thanks!

Activity

  1. added
    question
    on Feb 8, 2024
  2. szymonrybczak commented on Feb 8, 2024

    @szymonrybczak
    Collaborator

    hey @aljidy, I think we can update docs to also cover in --mode's description that it can accept buildVariant. Do you mind sending PR updating this? 🙏

  3. cortinico commented on Feb 8, 2024

    @cortinico
    Member

    I feel we should be able to remove --variant entirely at this point?

  4. szymonrybczak commented on Feb 8, 2024

    @szymonrybczak
    Collaborator

    @cortinico it's removed already.

  5. cortinico commented on Feb 8, 2024

    @cortinico
    Member

    Oh from the docs as well?

  6. szymonrybczak commented on Feb 9, 2024

    @szymonrybczak
    Collaborator

    Yup.

  7. aljidy commented on Feb 12, 2024

    @aljidy
    Author

    Thanks folks, will get a PR up later this week and ping you both

  8. zfben commented on Feb 22, 2024

    @zfben

    I used the original value of the variant parameter to pass into mode, and I found that the error message indicates a dependency content could not be found.

    Like:

    android/app/src/debug/java/cn/demo/app/ReactNativeFlipper.java:10: error: package com.facebook.flipper.android does not exist
    import com.facebook.flipper.android.AndroidFlipperClient;
    

    Did I use it in wrong way?

  9. szymonrybczak commented on Feb 28, 2024

    @szymonrybczak
    Collaborator

    hey @zfben, your error is not related to this issue. If the problem still occurs please create new issue with the related description and reproduction steps.

  10. Splanis commented on May 23, 2024

    @Splanis

    Hello, after the upgrade from 0.72.8 to 0.74.1 I noticed that --variant is deprecated. I changed it to --mode but I noticed that the build was not on debug mode(not connected to metro). I tried to add this on build.gradle debuggableVariants = ["stagingdebug", "productiondebug"] but android won't connect to metro, I get error "could not load server". Is this related somehow?

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

    question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions