2

我目前正在构建一个 React Native 应用程序,该应用程序目前仅在 Android 上可用。我决定使用 Code Push 来更新应用程序,而不会延迟 Google Play 分析。我在我的项目上安装了 react native 库,并使用 CLI 成功连接了我的 App Center 帐户,将密钥添加到 build.gradle 和我的 App 入口点文件上的 HOC。问题是当我运行应用程序时,我不断收到错误消息。我怀疑我得到了这个,因为我只为 Android 而不是 iOS 设置了 Code Push。如果是这种情况,解决问题的最明智的方法是什么?从项目中弹出iOS文件夹还是什么?我会很感激任何提示。谢谢。

错误日志

[CodePush] 同步已在进行中。LOG
[CodePush] 检查更新。LOG
[CodePush] 发生未知错误。LOG
[CodePush] 400:更新检查必须包含有效的部署密钥 - 请检查您的应用程序是否已正确配置。要查看可用的部署密钥,请运行“code-push deployment ls -k”。

我在 build.gradle 上的 buildTypes 部分

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"'
    }
}

这是我的入口点文件

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);
4

0 回答 0