2

I'm currently building a React Native app which will be available only on Android for now. I decided to use Code Push to update the app without the Google Play analysis delay. I installed the react native library on my project and successfully connected my App Center account using the CLI, added the keys to the build.gradle and the HOC on my App entrypoint file. The problem is that when I run the app I keep getting an error. I suspect I'm getting this because I have Code Push set up only for Android and not iOS. If this is the case what would be the smartest way to solve the problem? Eject iOS folder from the project or something? I'd appreciate any tips. Thanks.

The error log

[CodePush] Sync already in progress. LOG
[CodePush] Checking for update. LOG
[CodePush] An unknown error occurred. LOG
[CodePush] 400: An update check must include a valid deployment key - please check that your app has been configured correctly. To view available deployment keys, run 'code-push deployment ls -k'.

My buildTypes section on build.gradle

buildTypes {
    debug {
        signingConfig signingConfigs.debug
        resValue "string", "CodePushDeploymentKey", '""'
    }
    releaseStaging {
        resValue "string", "CodePushDeploymentKey", '"XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"'

        // Note: It is a good idea to provide matchingFallbacks for the new buildType you create to prevent build issues
        // Add the following line if not already there
        matchingFallbacks = ['release']
    }
    release {
        // Caution! In production, you need to generate your own keystore file.
        // see https://facebook.github.io/react-native/docs/signed-apk-android.
        signingConfig signingConfigs.debug
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"

        resValue "string", "CodePushDeploymentKey", '"XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"'
    }
}

This is my entrypoint file

import React from 'react';
import { Provider } from 'react-redux';
import CodePush from 'react-native-code-push';
import { PersistGate } from 'redux-persist/integration/react';

import './config/ReactotronConfig';

import Routes from './routes';
import { store, persistor } from './store';
import { setTopLevelNavigator } from './utils/NavigationService';

function App() {
  return (
    <Provider store={store}>
      <PersistGate persistor={persistor}>
        <Routes ref={navigatorRef => setTopLevelNavigator(navigatorRef)} />
      </PersistGate>
    </Provider>
  );
}

export default CodePush({
  checkFrequency: CodePush.CheckFrequency.ON_APP_RESUME,
})(App);
  • When you run the app on local usually the `debug` build type is triggered. As per your post. I can see that you have empty string for `deploymentKey`. Can you try changing the build type and test? – Hannan Shaik Jun 03 '20 at 17:42
  • I encountered the same problem – ebyte Jun 19 '20 at 07:45
  • Yeah, I want to revisit this sometime in a near future. For the time being I decided to just manually build the bundle and upload It to the Play Store as I've always been doing. – Guilherme Ramalho Jul 02 '20 at 15:05

0 Answers0