skip to Main Content

We are banging our head over here. We updated to React Native 0.73.2 and keep getting the following errors below. Our master app still works fine with the older version but this just cant get pass this error on yarn start. We are on Windows also in Code.

* What went wrong:
Cannot locate tasks that match 'app:installDebug' as task 'installDebug' is ambiguous in project ':app'. Candidates are: 'installComexposure585Debug', 'installComexposure585DebugAndroidTest', 'installExposure0Debug', 'installExposure0DebugAndroidTest', 'installExposure511Debug', 'installExposure511DebugAndroidTest', 'installExposure8Debug', 'installExposure8DebugAndroidTest'.

build.gradle

productFlavors {
    exposure0 {
        applicationId project.env.get("ANDROID_APP_ID")
        resValue "string", "APP_LABEL", project.env.get("APP_LABEL")
        resValue "string", "build_config_package", "com.exposure"
    }
    exposure8 {
        applicationId project.env.get("ANDROID_APP_ID")
        resValue "string", "APP_LABEL", project.env.get("APP_LABEL")
        resValue "string", "build_config_package", "com.exposure"
    }
exposure511 {
        applicationId project.env.get("ANDROID_APP_ID")
        resValue "string", "APP_LABEL", project.env.get("APP_LABEL")
        resValue "string", "build_config_package", "com.exposure"
    }
    comexposure585 {
        applicationId project.env.get("ANDROID_APP_ID")
        resValue "string", "APP_LABEL", project.env.get("APP_LABEL")
        resValue "string", "build_config_package", "com.exposure"
    }
}

2

Answers


  1. The full changelog for React Native 0.73.2.

    In here, among a few of the breaking changes mentioned, the React Native Android Gradle Plugin (NAGP) had flavor support added.

    There are essentially two dimensions to gradle builds w/ Android Gradle.

    1. Build variants – Like debug and release. Usually intended to differentiate configurations relevant to this.
    2. Product flavors – Like comexposure585 or exposure0 in your case. Usually intended to differentiate different featuresets you may build with.

    Android Gradle will create a build variant, debug for debugging without explicitly being told to. For an app with only one flavor, that task would be app:installDebug.

    Now that NAGP has flavor support, these will instead generate as:
    app:install<FlavorName>Debug, app:install<FlavorName>Release, etc, for every flavor. Due to the upgrade, your build file now has these flavors.

    Based on the error, you need to invoke the build with: react-native run-android --mode comexposure585Debug, for example, if you wanted to build the comexposure585 flavor with the debug build variant.

    Hopefully this helps.

    Login or Signup to reply.
  2. i just used this and its work for me

    yarn react-native run-android –mode release

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search