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

I am trying to customize my Android RN project in accordance with the "native code" reaction in this section of the documents

My build.gradle file has the following 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 ran: react-native run-android --variant releaseStaging

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

Also tried to run 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 am missing?
Thank!
Uri

+4
source share
2 answers

You must add signConfig to ReleaseStaging.

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

. 0.38, react-native run-android --variant=releaseStaging, , . response-native, react-native run-android --configuration=releaseStaging .

+6

Android Gradle (, debug, release)

, android/app/build.gradle React Native

android {
...
buildTypes {
    debug {
        ...
        // Note: CodePush updates should not be tested in Debug mode as they are overriden by the RN packager. However, because CodePush checks for updates in all modes, we must supply a key.
        buildConfigField "String", "CODEPUSH_KEY", '""'
        ...
    }

    releaseStaging {
        ...
        buildConfigField "String", "CODEPUSH_KEY", '"<INSERT_STAGING_KEY>"'
        signingConfig signingConfigs.release
        ... 
    }

    release {
        ...
        buildConfigField "String", "CODEPUSH_KEY", '"<INSERT_PRODUCTION_KEY>"'
        signingConfig signingConfigs.release
        ...
    }
}
...

}

. CodePush , RN-. , CodePush , .

buildConfigField "String", "CODEPUSH_KEY", '""'

- ;

`react-native run-android --variant releaseStaging`
0

Source: https://habr.com/ru/post/1669787/


All Articles