Skip to content

"Could not find method productFlavor() for arguments" after upgrading to 0.76.0 #306

Open
@ReijiTBK

Description

Environment

Omitted ios because am no issue in iOS

System:
  OS: macOS 15.1.1
  CPU: (8) arm64 Apple M1
  Memory: 146.89 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.9.0
    path: /usr/local/bin/node
  Yarn: Not Found
  npm:
    version: 10.8.0
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.10.14.00
    path: /opt/homebrew/bin/watchman
Managers:
SDKs:
  Android SDK:
    API Levels:
      - "23"
      - "28"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
    Build Tools:
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 36.0.0
    System Images:
      - android-21 | Google APIs ARM EABI v7a
      - android-25 | Google APIs ARM 64 v8a
      - android-26 | Google APIs ARM 64 v8a
      - android-27 | ARM 64 v8a
      - android-27 | Google APIs ARM 64 v8a
      - android-29 | Google APIs ARM 64 v8a
      - android-30 | Google APIs ARM 64 v8a
      - android-32 | Desktop ARM 64 v8a
      - android-33 | Desktop ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-S | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11076708
Languages:
  Java:
    version: 17.0.13
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.0-alpha.2
    wanted: 15.0.0-alpha.2
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.0
    wanted: 0.76.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: false
  newArchEnabled: false

Things I’ve done to figure out my issue

Upgrading version

0.72.6 -> 0.76.0

Description

After making the necessary changes, i keep encountering the following error, the local is one of the productFlavours i specified in the app/build.gradle

Could not find method local() for arguments [build_8jja1bi60n2os0zcgj2y070gu$_run_closure2$_closure14$_closure28$_closure29@59f56bb8] on BuildType$AgpDecorated_Decorated{name=productFlavors, debuggable=false, testCoverageEnabled=false, jniDebuggable=false, pseudoLocalesEnabled=false, renderscriptDebuggable=false, renderscriptOptimLevel=3, minifyEnabled=false, zipAlignEnabled=true, signingConfig=null, embedMicroApp=true, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}} of type com.android.build.gradle.internal.dsl.BuildType$AgpDecorated. * 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.

How productFlavors are being done, it is working in my previous version

        productFlavors {
            local {
                resValue "string", "app_name", "APP-LOCAL"
                buildConfigField "boolean", "TESTING_MODE", "true"
                applicationIdSuffix ".dev"
            }
            dev {
                resValue "string", "app_name", "APP-DEV"
                buildConfigField "boolean", "TESTING_MODE", "true"
                applicationIdSuffix ".dev"
            }
            staging {
                resValue "string", "app_name", "APP-STG"
                buildConfigField "boolean", "TESTING_MODE", "true"
                applicationIdSuffix ".stg"
            }
            prd {
                resValue "string", "app_name", "APP"
                buildConfigField "boolean", "TESTING_MODE", "false"
            }
        }

Reproducible demo

after making the changes, as long as i run a building method, it will show the error

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions