Adding product flavours causes build to hang on :app:createBundleDevelopmentDebugJsAndAssets task

I’ve started adding product flavours to a react native android app as described here. But running the start script react-native run-android --mode=developmentdebug --appId .dev hangs indefinitely on :app:createBundleDevelopmentDebugJsAndAssets task.

Before adding the productFlavors to the build.gradle the app would start with react-native run-android".

Looking at other apps that setup product flavours, I don’t see anything different in my build.gradle config.

Any ideas what could be going wrong here with the createBundleDevelopmentDebugJsAndAssets task?

Logs (The task just hangs at 11%)

Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

> Configure project :app
Reading env from: .env.debug
WARNING: DSL element 'dexOptions' is obsolete and should be removed.
It will be removed in version 8.0 of the Android Gradle plugin.
Using it has no effect, and the AndroidGradle plugin optimizes dexing automatically.

> Configure project :react-native-reanimated
Android gradle plugin: 8.1.1
Gradle: 8.3

> Task :app:createBundleDevelopmentDebugJsAndAssets
debug Reading Metro config from /Users/brianvarley/Projects/ChillMode/metro.config.js
warning: the transform cache was reset.
                Welcome to Metro v0.80.6
              Fast - Scalable - Integrated


<=------------> 11% EXECUTING [9m 12s]
> IDLE
> :app:createBundleDevelopmentDebugJsAndAssets

This is a summarised version of the app/build.gradle for reference:

apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"

project.ext.envConfigFiles = [
   productionrelease: ".env.prod",
   developmentdebug: ".env.debug",
]

project.ext.react = [
    inputExcludes: ["ios/**", "__tests__/**", "bundle_out/**"]
];
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

...

android {

    dexOptions {
        preDexLibraries false
        javaMaxHeapSize "8g"
    }

    ndkVersion rootProject.ext.ndkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion
    compileSdk rootProject.ext.compileSdkVersion

    namespace "com.bvapps.chillmode"
    flavorDimensions "default"
    defaultConfig {
        applicationId "com.bvapps.chillmode"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
        release {
            if (project.env.get('RELEASE_STORE_FILE')) {
                storeFile file(project.env.get('RELEASE_STORE_FILE'))
                storePassword project.env.get('RELEASE_STORE_PASSWORD')
                keyAlias project.env.get('RELEASE_KEY_ALIAS')
                keyPassword project.env.get('RELEASE_KEY_PASSWORD')
            }
        }
    }
    productFlavors {
        production {
            dimension "default"
            applicationIdSuffix ".prod"
        }
        development {
            dimension "default"
            applicationIdSuffix ".dev"
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
            signingConfig signingConfigs.debug
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
}

dependencies {
    // The version of react-native is set by the React Native Gradle Plugin
    implementation("com.facebook.react:react-android")
    implementation("com.facebook.react:flipper-integration")

    if (hermesEnabled.toBoolean()) {
        implementation("com.facebook.react:hermes-android")
    } else {
        implementation jscFlavor
    }
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)


So I needed to first build the initial app apks using Android Studio. I guess when I changed the package name to com.bvapps.chillmode in manifest from what it was originally (com.myapp)react-native could no longer find the apk file.

Once I did this the app runs again with react-native run-android --mode=devDebug.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật