Search code examples
androidreact-nativestagingcode-pushreact-native-code-push

Codepush React Native Android staging- Task installReleaseStagingDebug not found in root project


I'm trying to configure my RN android project according to this section of the react-native-code-push docs

My build.gradle file has this configuration:

buildTypes {
        debug {
        }
        releaseStaging {
            buildConfigField "String", "CODEPUSH_KEY", CODEPUSH_KEY_STAGING
        }
        release {
            buildConfigField "String", "CODEPUSH_KEY", CODEPUSH_KEY_PRODUCTION
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }

but when i run: react-native run-android --variant releaseStaging

I get the error: Task 'installReleaseStagingDebug' not found in root project 'MyAppName'.

Also tried running react-native run-android --configuration releaseStaging

Which gave me a slightly better error:

Task 'installReleaseStaging' not found in root project 'MyAppName'. Some candidates are: 'uninstallReleaseStaging'.

Any idea what i'm missing?
Thanks!
Uri


Solution

  • You have to add signingConfig to the releaseStaging.

        releaseStaging {
            signingConfig signingConfigs.release
            buildConfigField "String", "CODEPUSH_KEY", CODEPUSH_KEY_STAGING
        }
    

    Then you can install it to your device. I have react-native version 0.38 so I installed it with react-native run-android --variant=releaseStaging , but this might be different for other react-native versions. If you have a newer version of react-native, you can do react-native run-android --configuration=releaseStaging instead.