我是React Native的新手我想知道如何在服务器上部署反应本机部分或代码(如javascript文件和资源)然后使用它.
目前它显示为localhost
请告诉我如何在服务器上部署它也是可能的.
每当我更改代码中的某些内容时,是否需要更新Play商店中的应用程序?
什么样的代码推送做什么,有什么方法可以从服务器加载我的反应本机包并动态更新应用程序
javascript android react-native react-native-android react-native-code-push
我正在尝试根据react-native-code-push文档的这一部分配置我的RN android项目
我的build.gradle文件具有以下配置:
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
}
}
Run Code Online (Sandbox Code Playgroud)
但当我跑: react-native run-android --variant releaseStaging
我收到错误: Task 'installReleaseStagingDebug' not found in root project 'MyAppName'.
也试过跑 react-native run-android --configuration releaseStaging
这给了我一个稍好的错误:
Task 'installReleaseStaging' not found in root project 'MyAppName'. Some candidates are: 'uninstallReleaseStaging'.
Run Code Online (Sandbox Code Playgroud)
知道我错过了什么吗?
谢谢!
乌里
android staging react-native code-push react-native-code-push
我目前正在React Native进行研发.
我有一个要求,我需要在应用程序中添加一些模块(基本上是代码).
在原生iOS应用程序中不可能这样做.
在使用AppHub和CodePush等工具的React原生应用程序中,我们可以将构建推送到生产应用程序.有一个库React Native Auto Updater用于下载最新的js包,但现在已弃用.
使用上面的工具,我需要推送构建.
我有一个场景,我希望该应用程序获取并下载保存在远程服务器上的捆绑包.
那么,如何从App下载REST代码并根据新的JS代码刷新应用程序?
我关注的是JS代码的下载.我很清楚应用程序部分的自动更新.
提前致谢.
我已经为代码推送配置了一个应用程序,除了开玩笑测试之外它运行良好.它无法为此错误呈现应用:
TypeError: Cannot read property 'CheckFrequency' of undefined
at Object.<anonymous> (app/index.js:7:66)
at Object.<anonymous> (index.ios.js:5:12)
at Object.<anonymous> (__tests__/index.ios.js:4:12)
Run Code Online (Sandbox Code Playgroud)
在这一行:
const codePushOptions = { checkFrequency: codePush.CheckFrequency.MANUAL };
Run Code Online (Sandbox Code Playgroud)
测试代码是:
import App from '../index.ios';
it('renders correctly', () => {
const tree = renderer.create(
<App />,
);
});
Run Code Online (Sandbox Code Playgroud) 我使用react-native-code-push。即:
该插件为 CodePush 服务提供客户端集成,让您可以轻松地为 React Native 应用程序添加动态更新体验。
但是在一些原生的导航实现中,比如react-native-navigation没有任何根组件。该应用程序将开始调用这样的函数:
// index.js
import { Navigation } from 'react-native-navigation';
Navigation.startTabBasedApp({
tabs: [
{
label: 'One',
screen: 'example.FirstTabScreen', // this is a registered name for a screen
icon: require('../img/one.png'),
selectedIcon: require('../img/one_selected.png'), // iOS only
title: 'Screen One'
},
{
label: 'Two',
screen: 'example.SecondTabScreen',
icon: require('../img/two.png'),
selectedIcon: require('../img/two_selected.png'), // iOS only
title: 'Screen Two'
}
]
});
// or a single screen app like:
Navigation.registerComponent('example.MainApplication', () => MainComponent);
Navigation.startSingleScreenApp({
screen: { …Run Code Online (Sandbox Code Playgroud) reactjs react-native react-native-code-push react-native-navigation
我的 index.js 文件注册了多个根组件,如下所示
import RNUserInfo from 'custom_auth/react/user/user-info/components/entry/user-info'
AppRegistry.registerComponent('RNUserInfo', () => RNUserInfo);
import RNProduct from 'product/react/components/entry/product-entry'
AppRegistry.registerComponent('RNProduct', () => RNProduct);
Run Code Online (Sandbox Code Playgroud)
通过上述设置可以使用 codepush 吗?
我只能找到具有单根组件的示例
我正在尝试实施 AppCenter CodePush 来更新 Javascript 代码,而无需经过 App Store 审核流程。
我已按照此处提到的 iOS 和 Android 步骤来设置多部署环境: https://github.com/microsoft/react-native-code-push/blob/master/docs/multi-deployment-testing-ios。 md https://github.com/microsoft/react-native-code-push/blob/master/docs/multi-deployment-testing-android.md
版本
"react-native": "0.59.10"
"react-native-code-push": "^5.6.1"
我在 Android 上尝试过,react-native run-android --variant release在 iOS 上我将 RUN 和 Archive 方案更改为 STAGING。但在这两种情况下,他们似乎都是像这样获取我的包[CodePush] Loading JS bundle from "assets://index.android.bundle",而不是从 CodePush 存储库中获取。这是我看到的唯一输出(CodePush 相关)。
我制作了一个 codePush 版本,如下所示appcenter codepush release-react -a name/appName-1 -d Staging:此命令成功,我在 iOS 和 Android 暂存环境中看到它具有正确的版本。
组件已挂载
componentDidMount() {
codePush.notifyApplicationReady();
...
codePush.sync({
updateDialog: true,
installMode: codePush.InstallMode.IMMEDIATE
});
}
Run Code Online (Sandbox Code Playgroud)
导出应用程序
App = codePush({
checkFrequency: codePush.CheckFrequency.ON_APP_RESUME …Run Code Online (Sandbox Code Playgroud) react-native code-push react-native-code-push react-navigation
我将把 codepush 应用于 React-Native。
该应用程序目前已分发到商店。我还没有应用codepush。
但我有一个问题。
例如,假设商店中部署的应用程序版本为v1.0.0。我们应用了 codepush(登台、生产)来将版本 v1.0.1 分发到商店。
另外,我们需要简单的代码修改,而不是原生代码,因此我们将其分发到 codepush 生产环境而不是商店。
这种情况下,应该如何管理版本呢?我是否将其更改为v1.0.2?
在上面的例子中,问题是商店版本是v1.0.1,codepush版本是v1.0.2。使用codepush的用户将收到对应于v1.0.2的捆绑程序更新,但版本早于v1.0.1的用户将无法收到更新。
那么,分发codepush,也分发到商店好不好?
我在使用codepush进行内部测试时没有这个顾虑,但我正在尝试将其应用到商店中分发的应用程序中,因此我不知道如何处理版本控制。
有人可以帮助我吗?
javascript versioning react-native code-push react-native-code-push
我不小心用临时密钥推送了二进制文件。除了明显的命名差异之外,这两个阶段(就 cli / library 设置而言)是否有任何真正的区别?
我在尝试使用暂存环境推送更新时会遇到问题吗?
yarn add react-native-codepushandroid/app/build.gradleapply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
Run Code Online (Sandbox Code Playgroud)
MainApplication.javaapply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
Run Code Online (Sandbox Code Playgroud)
strings.xml <string name="CodePushDeploymentKey" moduleConfig="true">MYKEY</string>
Run Code Online (Sandbox Code Playgroud)
构建应该成功
实际发生了什么?
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 998 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...
> Configure project :app
WARNING: BuildType(debug): resValue 'react_native_dev_server_port' value is being replaced: 8081 -> 8081 …Run Code Online (Sandbox Code Playgroud) android react-native code-push react-native-code-push visual-studio-app-center
我使用应用程序中心网站上的“添加新应用程序”选项添加了一个反应本机 Android 应用程序。现在我需要找到相同的部署密钥。我尝试了
代码推送部署列表 YourAppName --displayKeys
但它没有返回密钥。
尽管当我使用 CLI
code-push app add YourAppName android react-native 添加应用程序
,然后使用之前的命令检索密钥时,它工作正常并提供 staging 和 pro 密钥。
请有人解释一下这一点。
谢谢。
当我尝试实现 codepush 时,收到此错误:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
70 actionable tasks: 7 executed, 63 up-to-date
/Users/lukeschoenberger/Documents/Programming/news-arg/test7/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:59: error: cannot find symbol
new CodePush(getResources().getString(R.string.reactNativeCodePush_androidDeploymentKey), getApplicationContext(), BuildConfig.DEBUG),
^
symbol: variable reactNativeCodePush_androidDeploymentKey
location: class string
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try: …Run Code Online (Sandbox Code Playgroud) 我尝试使用以下命令检索代码推送部署密钥:
appcenter codepush deployment list -a <name/appName> --displayKeys
它返回一个空表:
iOS/Android 应用程序已添加到应用程序中心控制台
react-native react-native-code-push visual-studio-app-center
react-native ×11
code-push ×7
android ×5
javascript ×3
app-hub ×1
ios ×1
jestjs ×1
jsx ×1
reactjs ×1
staging ×1
versioning ×1