From 60993983cb2ecd19315129128d6ec8620709ff2c Mon Sep 17 00:00:00 2001 From: sunnylqm Date: Sat, 13 Apr 2024 03:39:19 +0000 Subject: [PATCH] deploy: f60a985c135032aa926918983ea337d20bde3c95 --- 404.html | 2 +- .../_buildManifest.js | 2 +- .../_ssgManifest.js | 0 .../chunks/pages/docs/getting-started-0d88929bcb8aed90.js | 1 + .../chunks/pages/docs/getting-started-6f21576813a0d599.js | 1 - docs/api.html | 4 ++-- docs/bestpractice.html | 4 ++-- docs/changelog.html | 4 ++-- docs/cli.html | 4 ++-- docs/faq.html | 4 ++-- docs/getting-started.html | 6 +++--- docs/integration.html | 4 ++-- docs/publish.html | 4 ++-- index.html | 2 +- pricing.html | 2 +- 15 files changed, 22 insertions(+), 22 deletions(-) rename _next/static/{2K3H_K2eCICm_pF5i0SbS => 8lmpkeVM9NYfQfoemtozk}/_buildManifest.js (95%) rename _next/static/{2K3H_K2eCICm_pF5i0SbS => 8lmpkeVM9NYfQfoemtozk}/_ssgManifest.js (100%) create mode 100644 _next/static/chunks/pages/docs/getting-started-0d88929bcb8aed90.js delete mode 100644 _next/static/chunks/pages/docs/getting-started-6f21576813a0d599.js diff --git a/404.html b/404.html index 37de105..20d58fc 100644 --- a/404.html +++ b/404.html @@ -1 +1 @@ -404: This page could not be found

404

This page could not be found.

\ No newline at end of file +404: This page could not be found

404

This page could not be found.

\ No newline at end of file diff --git a/_next/static/2K3H_K2eCICm_pF5i0SbS/_buildManifest.js b/_next/static/8lmpkeVM9NYfQfoemtozk/_buildManifest.js similarity index 95% rename from _next/static/2K3H_K2eCICm_pF5i0SbS/_buildManifest.js rename to _next/static/8lmpkeVM9NYfQfoemtozk/_buildManifest.js index 13fc329..5c8c63b 100644 --- a/_next/static/2K3H_K2eCICm_pF5i0SbS/_buildManifest.js +++ b/_next/static/8lmpkeVM9NYfQfoemtozk/_buildManifest.js @@ -1 +1 @@ -self.__BUILD_MANIFEST=function(s){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":[s,"static/chunks/204-efd22c4551fb5267.js","static/chunks/pages/index-509bd1e50d9b254d.js"],"/_error":["static/chunks/pages/_error-597a4d22bfd9f834.js"],"/docs/api":[s,"static/chunks/pages/docs/api-3413f540a57d3e48.js"],"/docs/bestpractice":[s,"static/chunks/pages/docs/bestpractice-cbecc9344854c4e5.js"],"/docs/changelog":[s,"static/chunks/pages/docs/changelog-fa6c4e00d6b09818.js"],"/docs/cli":[s,"static/chunks/pages/docs/cli-12e4c433877ddf6f.js"],"/docs/faq":[s,"static/chunks/pages/docs/faq-34323f38aad934eb.js"],"/docs/getting-started":[s,"static/chunks/pages/docs/getting-started-6f21576813a0d599.js"],"/docs/integration":[s,"static/chunks/pages/docs/integration-8c41c5ec313abda8.js"],"/docs/publish":["static/chunks/42a66924-0d7bd80c91c5e651.js",s,"static/chunks/807-49d8b251beaa03c4.js","static/chunks/pages/docs/publish-1604d2fd1bd512a9.js"],"/pricing":[s,"static/chunks/795-b544068780b87a9b.js","static/chunks/pages/pricing-877557ee472599ef.js"],sortedPages:["/","/_app","/_error","/docs/api","/docs/bestpractice","/docs/changelog","/docs/cli","/docs/faq","/docs/getting-started","/docs/integration","/docs/publish","/pricing"]}}("static/chunks/567-f79a5439ce425142.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file +self.__BUILD_MANIFEST=function(s){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":[s,"static/chunks/204-efd22c4551fb5267.js","static/chunks/pages/index-509bd1e50d9b254d.js"],"/_error":["static/chunks/pages/_error-597a4d22bfd9f834.js"],"/docs/api":[s,"static/chunks/pages/docs/api-3413f540a57d3e48.js"],"/docs/bestpractice":[s,"static/chunks/pages/docs/bestpractice-cbecc9344854c4e5.js"],"/docs/changelog":[s,"static/chunks/pages/docs/changelog-fa6c4e00d6b09818.js"],"/docs/cli":[s,"static/chunks/pages/docs/cli-12e4c433877ddf6f.js"],"/docs/faq":[s,"static/chunks/pages/docs/faq-34323f38aad934eb.js"],"/docs/getting-started":[s,"static/chunks/pages/docs/getting-started-0d88929bcb8aed90.js"],"/docs/integration":[s,"static/chunks/pages/docs/integration-8c41c5ec313abda8.js"],"/docs/publish":["static/chunks/42a66924-0d7bd80c91c5e651.js",s,"static/chunks/807-49d8b251beaa03c4.js","static/chunks/pages/docs/publish-1604d2fd1bd512a9.js"],"/pricing":[s,"static/chunks/795-b544068780b87a9b.js","static/chunks/pages/pricing-877557ee472599ef.js"],sortedPages:["/","/_app","/_error","/docs/api","/docs/bestpractice","/docs/changelog","/docs/cli","/docs/faq","/docs/getting-started","/docs/integration","/docs/publish","/pricing"]}}("static/chunks/567-f79a5439ce425142.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/_next/static/2K3H_K2eCICm_pF5i0SbS/_ssgManifest.js b/_next/static/8lmpkeVM9NYfQfoemtozk/_ssgManifest.js similarity index 100% rename from _next/static/2K3H_K2eCICm_pF5i0SbS/_ssgManifest.js rename to _next/static/8lmpkeVM9NYfQfoemtozk/_ssgManifest.js diff --git a/_next/static/chunks/pages/docs/getting-started-0d88929bcb8aed90.js b/_next/static/chunks/pages/docs/getting-started-0d88929bcb8aed90.js new file mode 100644 index 0000000..d500c55 --- /dev/null +++ b/_next/static/chunks/pages/docs/getting-started-0d88929bcb8aed90.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[153],{30876:function(s,e,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/docs/getting-started",function(){return n(20797)}])},20797:function(s,e,n){"use strict";n.r(e),n.d(e,{__toc:function(){return a}});var l=n(11527),i=n(38567),r=n(87088),o=n(42416);let a=[{depth:3,value:"安装",id:"安装"},{depth:3,value:"手动 link",id:"手动-link"},{depth:4,value:"iOS",id:"ios"},{depth:4,value:"Android",id:"android"},{depth:3,value:"配置 Bundle URL",id:"配置-bundle-url"},{depth:4,value:"iOS",id:"ios-1"},{depth:4,value:"Android",id:"android-1"},{depth:3,value:"禁用 android 的 crunch 优化",id:"禁用-android-的-crunch-优化"},{depth:3,value:"登录与创建应用",id:"登录与创建应用"}];function c(s){let e=Object.assign({p:"p",a:"a",code:"code",h3:"h3",pre:"pre",span:"span",h4:"h4",details:"details",summary:"summary",ol:"ol",li:"li",ul:"ul"},(0,r.a)(),s.components);return o.mQ||t("Tabs",!1),o.mQ.Tab||t("Tabs.Tab",!0),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o.UW,{type:"info",children:(0,l.jsxs)(e.p,{children:["请注意,当前版本的api经过了完全重构,与之前的版本(v10.0以下)不兼容。如果你需要查看之前版本的文档,请点击",(0,l.jsx)(e.a,{href:"https://v9--pushy-site.netlify.app/",children:"这里"})]})}),"\n",(0,l.jsxs)(e.p,{children:["首先你应该有一个基于 React Native 开发的应用,我们把具有 package.json 的目录叫做你的",(0,l.jsx)(e.code,{children:"应用根目录"}),"。\n如果你还没有初始化应用,请参阅",(0,l.jsx)(e.a,{href:"https://reactnative.cn/docs/getting-started",children:"开始使用 React Native"}),"。"]}),"\n",(0,l.jsxs)(e.p,{children:["我们假设你已经拥有了开发 React Native 应用的一切环境,包括",(0,l.jsx)(e.code,{children:"Node.js"}),"、",(0,l.jsx)(e.code,{children:"Xcode"}),"、",(0,l.jsx)(e.code,{children:"Android SDK"}),"等等。"]}),"\n",(0,l.jsxs)(o.Rg,{children:[(0,l.jsx)(e.h3,{id:"安装",children:"安装"}),(0,l.jsx)(e.p,{children:"在你的项目根目录下运行以下命令:"}),(0,l.jsx)(e.pre,{"data-language":"bash","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"bash","data-theme":"default",children:[(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"# 先全局安装命令行工具,每台电脑只用装一次"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"npm"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"i"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"-g"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"react-native-update-cli"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"# 然后在项目目录中安装热更新模块"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"npm"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"i"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"react-native-update"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"# 然后进入ios目录安装iOS模块"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"cd"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"ios"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-punctuation)"},children:"&&"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"pod"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"install"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "})]})}),(0,l.jsx)(o.UW,{type:"info",children:(0,l.jsxs)(e.p,{children:["如果下载极慢或者显示网络失败,请设置使用淘宝镜像 ",(0,l.jsx)(e.code,{children:"npx nrm use taobao"})]})}),(0,l.jsx)(o.UW,{type:"warning",children:(0,l.jsxs)(e.p,{children:["注意请不要混用",(0,l.jsx)(e.code,{children:"npm/yarn/pnpm"}),"等包管理器及对应的",(0,l.jsx)(e.code,{children:"lock"}),"文件,团队成员请坚持使用同一包管理器,且仅保留统一格式的",(0,l.jsx)(e.code,{children:"lock"}),"文件"]})}),(0,l.jsx)(o.UW,{type:"info",children:(0,l.jsx)(e.p,{children:"请记得,任意在 ios 和 android 目录下的修改,一定要重新编译(使用 npx\nreact-native run-ios 或 run-android 命令编译,或在 Xcode/Android Studio\n中重新编译)才能生效。"})}),(0,l.jsx)(e.h3,{id:"手动-link",children:"手动 link"}),(0,l.jsx)(e.p,{children:"如果 RN 版本 >= 0.60 则不需要此手动 link 步骤。"}),(0,l.jsx)(o.UW,{type:"warning",children:(0,l.jsx)(e.p,{children:"注意:如果是混编 RN\n项目,或monorepo,或任何其他自定义的情况,由于自定义的配置可能不完整或不适应RN的目录结构,导致自动\nlink 的功能可能不能正常工作。此时即便 RN 版本 >= 0.60,你可能也需要执行手动\nlink 操作。"})}),(0,l.jsx)(e.h4,{id:"ios",children:"iOS"}),(0,l.jsxs)(e.details,{children:[(0,l.jsx)(e.summary,{children:"RN < 0.60且使用CocoaPods(推荐)"}),(0,l.jsxs)(e.ol,{children:["\n",(0,l.jsx)(e.li,{children:"在 ios/Podfile 中添加"}),"\n"]}),(0,l.jsx)(e.pre,{"data-language":"text","data-theme":"default",children:(0,l.jsx)(e.code,{"data-language":"text","data-theme":"default",children:(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"pod 'react-native-update', path: '../node_modules/react-native-update'"})})})}),(0,l.jsxs)(e.ol,{start:"2",children:["\n",(0,l.jsxs)(e.li,{children:["在项目的 ios 目录下运行",(0,l.jsx)(e.code,{children:"pod install"})]}),"\n",(0,l.jsx)(e.li,{children:"重新编译"}),"\n"]})]}),(0,l.jsxs)(e.details,{children:[(0,l.jsx)(e.summary,{children:"RN < 0.60且不使用CocoaPods"}),(0,l.jsxs)(e.ol,{children:["\n",(0,l.jsxs)(e.li,{children:["在 XCode 中的 Project Navigator 里,右键点击",(0,l.jsx)(e.code,{children:"Libraries"})," ➜ ",(0,l.jsx)(e.code,{children:"Add Files to [你的工程名]"})]}),"\n",(0,l.jsxs)(e.li,{children:["进入",(0,l.jsx)(e.code,{children:"node_modules"})," ➜ ",(0,l.jsx)(e.code,{children:"react-native-update"})," ➜ ",(0,l.jsx)(e.code,{children:"ios 并选中"}),"RCTPushy.xcodeproj`"]}),"\n",(0,l.jsxs)(e.li,{children:["在 XCode 中的 project navigator 里,选中你的工程,在 ",(0,l.jsx)(e.code,{children:"Build Phases"})," ➜ ",(0,l.jsx)(e.code,{children:"Link Binary With Libraries"})," 中添加 ",(0,l.jsx)(e.code,{children:"libRCTPushy.a"}),"、",(0,l.jsx)(e.code,{children:"libz.tbd"}),"、",(0,l.jsx)(e.code,{children:"libbz2.1.0.tbd"})]}),"\n",(0,l.jsxs)(e.li,{children:["继续在",(0,l.jsx)(e.code,{children:"Build Settings"}),"里搜索",(0,l.jsx)(e.code,{children:"Header Search Path"}),",添加",(0,l.jsx)(e.code,{children:"$(SRCROOT)/../node_modules/react-native-update/ios"}),",勾选",(0,l.jsx)(e.code,{children:"recursive"}),"。"]}),"\n",(0,l.jsxs)(e.li,{children:["在",(0,l.jsx)(e.code,{children:"Build Phases"}),"添加一个",(0,l.jsx)(e.code,{children:"New Run Script Phase"}),"运行脚本,内容如下"]}),"\n"]}),(0,l.jsx)(e.pre,{"data-language":"text","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"text","data-theme":"default",children:[(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"#!/bin/bash"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"set -x"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:'DEST="../node_modules/react-native-update/ios/"'})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:'date +%s > "$DEST/pushy_build_time.txt"'})})]})}),(0,l.jsxs)(e.ol,{start:"7",children:["\n",(0,l.jsxs)(e.li,{children:["尝试编译一下,顺利的话就会在",(0,l.jsx)(e.code,{children:"../node_modules/react-native-update/ios/"}),"文件夹下面生成一个",(0,l.jsx)(e.code,{children:"pushy_build_time.txt"}),"文件。然后在",(0,l.jsx)(e.code,{children:"Copy Bundle Resources"}),"里把生成的",(0,l.jsx)(e.code,{children:"pushy_build_time.txt"}),"文件添加进去。"]}),"\n"]})]}),(0,l.jsx)(e.h4,{id:"android",children:"Android"}),(0,l.jsxs)(e.details,{children:[(0,l.jsx)(e.summary,{children:"RN < 0.60"}),(0,l.jsxs)(e.ol,{children:["\n",(0,l.jsxs)(e.li,{children:["\n",(0,l.jsxs)(e.p,{children:["在",(0,l.jsx)(e.code,{children:"android/settings.gradle"}),"中添加如下代码:"]}),"\n",(0,l.jsx)(e.pre,{"data-language":"text","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"text","data-theme":"default",children:[(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"include ':react-native-update'"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"project(':react-native-update').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-update/android')"})})]})}),"\n"]}),"\n",(0,l.jsxs)(e.li,{children:["\n",(0,l.jsxs)(e.p,{children:["在",(0,l.jsx)(e.code,{children:"android/app/build.gradle"}),"的 dependencies 部分增加如下代码:"]}),"\n",(0,l.jsx)(e.pre,{"data-language":"text","data-theme":"default",children:(0,l.jsx)(e.code,{"data-language":"text","data-theme":"default",children:(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"implementation project(':react-native-update')"})})})}),"\n"]}),"\n",(0,l.jsxs)(e.li,{children:["\n",(0,l.jsxs)(e.p,{children:["打开",(0,l.jsx)(e.code,{children:"android/app/src/main/java/[...]/MainApplication.java"}),","]}),"\n"]}),"\n"]}),(0,l.jsxs)(e.ul,{children:["\n",(0,l.jsxs)(e.li,{children:["在文件开头增加 ",(0,l.jsx)(e.code,{children:"import cn.reactnative.modules.update.UpdatePackage;"})]}),"\n",(0,l.jsxs)(e.li,{children:["在",(0,l.jsx)(e.code,{children:"getPackages()"})," 方法中增加 ",(0,l.jsx)(e.code,{children:"new UpdatePackage()"}),"(注意上一行可能要增加一个逗号)"]}),"\n"]})]}),(0,l.jsx)(e.h3,{id:"配置-bundle-url",children:"配置 Bundle URL"}),(0,l.jsx)(e.p,{children:"注意此步骤无论任何版本,目前都需要手动配置。"}),(0,l.jsx)(e.h4,{id:"ios-1",children:"iOS"}),(0,l.jsx)(e.p,{children:"在你的 AppDelegate.mm 或 AppDelegate.m 文件(不同 RN 版本可能后缀名不同)中增加如下代码:"}),(0,l.jsx)(e.pre,{"data-language":"c","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"c","data-theme":"default",children:[(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ... 其它代码"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"#import"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"AppDelegate.h"'})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"#import"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"RCTPushy.h"'}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// <-- import头文件,注意要放到if条件外面"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// 可能项目里有一些条件编译语句,例如有些版本RN自带的flipper"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// #if DEBUG"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:'// 注意**不要**在这里面引入"RCTPushy.h"'})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// #import "})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ..."})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// #endif"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// 修改sourceURLForBridge方法"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"-"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" (NSURL "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"*"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:")sourceURLForBridge:(RCTBridge "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"*"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:")bridge"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"{"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"#if"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"DEBUG"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// 原先DEBUG这里的写法不作修改(所以DEBUG模式下不可热更新)"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"index"'}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"];"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"#else"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" [RCTPushy bundleURL];"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:" // <-- 把这里非DEBUG的情况替换为热更新bundle"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"#endif"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"}"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "})]})}),(0,l.jsx)(e.h4,{id:"android-1",children:"Android"}),(0,l.jsxs)(e.p,{children:["在 MainApplication 中增加如下代码(如果是混编原生的项目或其他原因没有使用 ReactApplication,请",(0,l.jsx)(e.a,{href:"api#updatecontextsetcustominstancemanagerreactinstancemanager-instancemanager",children:"使用此 api 集成"}),"):"]}),(0,l.jsxs)(o.mQ,{items:["Kotlin","Java"],children:[(0,l.jsx)(o.mQ.Tab,{children:(0,l.jsx)(e.pre,{"data-language":"kotlin","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"kotlin","data-theme":"default",children:[(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ... 其它代码"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ↓↓↓请注意不要少了这句import"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" cn.reactnative.modules.update.UpdateContext;"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ↑↑↑"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"class"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"MainApplication"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" : "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"Application"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"(), "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"ReactApplication"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"override"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"val"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" reactNativeHost: "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"ReactNativeHost"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"="})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" object : "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"DefaultReactNativeHost"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"this"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:") {"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ↓↓↓将下面这一段添加到 DefaultReactNativeHost 内部!"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"override"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"fun"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"getJSBundleFile"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"(): "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"String"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"? {"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" UpdateContext."}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"getBundleUrl"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"this@MainApplication"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:")"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" }"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ↑↑↑"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ...其他代码"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" }"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})})}),(0,l.jsx)(o.mQ.Tab,{children:(0,l.jsx)(e.pre,{"data-language":"java","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"java","data-theme":"default",children:[(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ... 其它代码"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ↓↓↓请注意不要少了这句import"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"cn"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-punctuation)"},children:"."}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"reactnative"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-punctuation)"},children:"."}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"modules"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-punctuation)"},children:"."}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"update"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-punctuation)"},children:"."}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"UpdateContext"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ↑↑↑"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"public"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"class"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"MainApplication"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"extends"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"Application"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"implements"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"ReactApplication"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"private"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"final"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"ReactNativeHost"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" mReactNativeHost "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"="})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// 老版本 RN 这里可能是 new ReactNativeHost(this)"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"new"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"DefaultReactNativeHost("}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"this"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:")"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ↓↓↓将下面这一段添加到 DefaultReactNativeHost 内部!"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" @"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"Override"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"protected"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"String"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"getJSBundleFile"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"() {"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"UpdateContext"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-punctuation)"},children:"."}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"getBundleUrl"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"MainApplication"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-punctuation)"},children:"."}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"this"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" }"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ↑↑↑"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ...其他代码"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" }"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})})})]}),(0,l.jsx)(o.UW,{type:"info",children:(0,l.jsx)(e.p,{children:"请记得,任意在 ios 和 android 目录下的修改,一定要重新编译(npx react-native\nrun-ios 或 run-android 命令编译,或在 Xcode/Android Studio\n中重新编译)才能生效。"})}),(0,l.jsx)(e.h3,{id:"禁用-android-的-crunch-优化",children:"禁用 android 的 crunch 优化"}),(0,l.jsxs)(e.p,{children:["android 会在生成 apk 时自动对 png 图片进行压缩,此操作既耗时又影响增量补丁的生成。为了保证补丁能正常生成,您需要在",(0,l.jsx)(e.code,{children:"android/app/build.gradle"}),"中关闭此操作:"]}),(0,l.jsx)(e.pre,{"data-language":"gradle","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"gradle","data-theme":"default",children:[(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"..."})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"android {"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" ..."})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" signingConfigs { ... }"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" buildTypes {"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" release {"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" ..."})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" // 添加下面这行以禁用crunch"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" crunchPngs false"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" }"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" }"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"}"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"..."})})]})}),(0,l.jsx)(e.h3,{id:"登录与创建应用",children:"登录与创建应用"}),(0,l.jsxs)(e.p,{children:["首先请在 ",(0,l.jsx)(e.a,{href:"https://update.reactnative.cn",children:"https://update.reactnative.cn"})," 注册帐号,然后在你的项目根目录下运行以下命令:"]}),(0,l.jsx)(e.pre,{"data-language":"bash","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"bash","data-theme":"default",children:[(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"$"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"pushy"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"login"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"email:"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"<"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"输入你的注册邮"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"箱"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:">"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"password:"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"<"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"输入你的密"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"码"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:">"})]})]})}),(0,l.jsxs)(e.p,{children:["这会在项目文件夹下创建一个",(0,l.jsx)(e.code,{children:".update"}),"文件,注意不要把这个文件上传到 Git 等 CVS 系统上。你可以在",(0,l.jsx)(e.code,{children:".gitignore"}),"末尾增加一行",(0,l.jsx)(e.code,{children:".update"}),"来忽略这个文件。"]}),(0,l.jsx)(e.p,{children:"登录之后可以创建应用。注意 iOS 平台和安卓平台需要分别创建:"}),(0,l.jsx)(e.pre,{"data-language":"bash","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"bash","data-theme":"default",children:[(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"$"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"pushy"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"createApp"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"--platform"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"ios"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"App"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"Name:"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"<"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"输入应用名"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"字"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:">"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"$"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"pushy"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"createApp"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"--platform"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"android"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"App"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"Name:"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"<"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"输入应用名"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"字"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:">"})]})]})}),(0,l.jsx)(o.UW,{type:"info",children:"两次输入的名字可以相同,这没有关系。"}),(0,l.jsx)(e.p,{children:"如果你已经在网页端或者其它地方创建过应用,也可以直接选择应用:"}),(0,l.jsx)(e.pre,{"data-language":"bash","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"bash","data-theme":"default",children:[(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"$"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"pushy"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"selectApp"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"--platform"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"ios"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"1"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:") 鱼多多("}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"ios"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:")"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"2"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:") 招财旺("}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"ios"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:")"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"Total"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"2"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"ios"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"apps"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"Enter"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"appId:"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"<"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"输入应用前面的编"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"号"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:">"})]})]})}),(0,l.jsxs)(e.p,{children:["选择或者创建过应用后,你将可以在文件夹下看到",(0,l.jsx)(e.code,{children:"update.json"}),"文件,其内容类似如下形式:"]}),(0,l.jsx)(e.pre,{"data-language":"bash","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"bash","data-theme":"default",children:[(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"{"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:'"ios"'}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:":"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"{"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:'"appId"'}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:":"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"1"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:","})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:'"appKey"'}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:":"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"<一串随机字符串>"'})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" },"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:'"android"'}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:":"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"{"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:'"appId"'}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:":"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"2"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:","})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:'"appKey"'}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:":"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"<一串随机字符串>"'})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" }"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),(0,l.jsxs)(e.p,{children:["你可以安全的把",(0,l.jsx)(e.code,{children:"update.json"}),"上传到 Git 等 CVS 系统上,与你的团队共享这个文件,它不包含任何敏感信息。当然,他们在使用任何功能之前,都必须首先输入",(0,l.jsx)(e.code,{children:"pushy login"}),"进行登录。"]}),(0,l.jsxs)(e.p,{children:["至此应用的创建/选择就已经成功了。下一步,你需要给代码添加相应的功能,请参阅",(0,l.jsx)(e.a,{href:"integration",children:"代码集成"}),"。"]})]})]})}function t(s,e){throw Error("Expected "+(e?"component":"object")+" `"+s+"` to be defined: you likely forgot to import, pass, or provide it.")}e.default=(0,i.j)({MDXContent:function(){let s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,r.a)(),s.components);return e?(0,l.jsx)(e,{...s,children:(0,l.jsx)(c,{...s})}):c(s)},pageOpts:{filePath:"pages/docs/getting-started.mdx",route:"/docs/getting-started",frontMatter:{order:0,title:"安装配置",type:"快速入门"},title:"安装配置",headings:a},pageNextRoute:"/docs/getting-started"})}},function(s){s.O(0,[567,888,774,179],function(){return s(s.s=30876)}),_N_E=s.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/pages/docs/getting-started-6f21576813a0d599.js b/_next/static/chunks/pages/docs/getting-started-6f21576813a0d599.js deleted file mode 100644 index 2184ec2..0000000 --- a/_next/static/chunks/pages/docs/getting-started-6f21576813a0d599.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[153],{30876:function(s,e,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/docs/getting-started",function(){return n(20797)}])},20797:function(s,e,n){"use strict";n.r(e),n.d(e,{__toc:function(){return a}});var l=n(11527),i=n(38567),r=n(87088),o=n(42416);let a=[{depth:3,value:"安装",id:"安装"},{depth:3,value:"手动 link",id:"手动-link"},{depth:4,value:"iOS",id:"ios"},{depth:4,value:"Android",id:"android"},{depth:3,value:"配置 Bundle URL",id:"配置-bundle-url"},{depth:4,value:"iOS",id:"ios-1"},{depth:4,value:"Android",id:"android-1"},{depth:3,value:"禁用 android 的 crunch 优化",id:"禁用-android-的-crunch-优化"},{depth:3,value:"登录与创建应用",id:"登录与创建应用"}];function c(s){let e=Object.assign({p:"p",a:"a",code:"code",h3:"h3",pre:"pre",span:"span",h4:"h4",details:"details",summary:"summary",ol:"ol",li:"li",ul:"ul"},(0,r.a)(),s.components);return o.mQ||t("Tabs",!1),o.mQ.Tab||t("Tabs.Tab",!0),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o.UW,{type:"info",children:(0,l.jsxs)(e.p,{children:["请注意,当前版本的api经过了完全重构,与之前的版本(v10.0以下)不兼容。如果你需要查看之前版本的文档,请点击",(0,l.jsx)(e.a,{href:"https://v9--pushy-site.netlify.app/",children:"这里"})]})}),"\n",(0,l.jsxs)(e.p,{children:["首先你应该有一个基于 React Native 开发的应用,我们把具有 package.json 的目录叫做你的",(0,l.jsx)(e.code,{children:"应用根目录"}),"。\n如果你还没有初始化应用,请参阅",(0,l.jsx)(e.a,{href:"https://reactnative.cn/docs/getting-started",children:"开始使用 React Native"}),"。"]}),"\n",(0,l.jsxs)(e.p,{children:["我们假设你已经拥有了开发 React Native 应用的一切环境,包括",(0,l.jsx)(e.code,{children:"Node.js"}),"、",(0,l.jsx)(e.code,{children:"Xcode"}),"、",(0,l.jsx)(e.code,{children:"Android SDK"}),"等等。"]}),"\n",(0,l.jsxs)(o.Rg,{children:[(0,l.jsx)(e.h3,{id:"安装",children:"安装"}),(0,l.jsx)(e.p,{children:"在你的项目根目录下运行以下命令:"}),(0,l.jsx)(e.pre,{"data-language":"bash","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"bash","data-theme":"default",children:[(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"# 先全局安装命令行工具,每台电脑只用装一次"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"npm"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"i"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"-g"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"react-native-update-cli"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"# 然后在项目目录中安装热更新模块"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"npm"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"i"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"react-native-update"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"# 然后进入ios目录安装iOS模块"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"cd"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"ios"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-punctuation)"},children:"&&"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"pod"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"install"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "})]})}),(0,l.jsx)(o.UW,{type:"info",children:(0,l.jsxs)(e.p,{children:["如果下载极慢或者显示网络失败,请设置使用淘宝镜像 ",(0,l.jsx)(e.code,{children:"npx nrm use taobao"})]})}),(0,l.jsx)(o.UW,{type:"warning",children:(0,l.jsxs)(e.p,{children:["注意请不要混用",(0,l.jsx)(e.code,{children:"npm/yarn/pnpm"}),"等包管理器及对应的",(0,l.jsx)(e.code,{children:"lock"}),"文件,团队成员请坚持使用同一包管理器,且仅保留统一格式的",(0,l.jsx)(e.code,{children:"lock"}),"文件"]})}),(0,l.jsx)(o.UW,{type:"info",children:(0,l.jsx)(e.p,{children:"请记得,任意在 ios 和 android 目录下的修改,一定要重新编译(使用 npx\nreact-native run-ios 或 run-android 命令编译,或在 Xcode/Android Studio\n中重新编译)才能生效。"})}),(0,l.jsx)(e.h3,{id:"手动-link",children:"手动 link"}),(0,l.jsx)(e.p,{children:"如果 RN 版本 >= 0.60 则不需要此手动 link 步骤。"}),(0,l.jsx)(o.UW,{type:"info",children:(0,l.jsx)(e.p,{children:"注意:如果是混编 RN\n项目,或monorepo,或任何其他自定义的情况,由于自定义的配置可能不完整或不适应RN的目录结构,导致自动\nlink 的功能可能不能正常工作。此时即便 RN 版本 >= 0.60,你可能也需要执行手动\nlink 操作。"})}),(0,l.jsx)(e.h4,{id:"ios",children:"iOS"}),(0,l.jsxs)(e.details,{children:[(0,l.jsx)(e.summary,{children:"RN < 0.60且使用CocoaPods(推荐)"}),(0,l.jsxs)(e.ol,{children:["\n",(0,l.jsx)(e.li,{children:"在 ios/Podfile 中添加"}),"\n"]}),(0,l.jsx)(e.pre,{"data-language":"text","data-theme":"default",children:(0,l.jsx)(e.code,{"data-language":"text","data-theme":"default",children:(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"pod 'react-native-update', path: '../node_modules/react-native-update'"})})})}),(0,l.jsxs)(e.ol,{start:"2",children:["\n",(0,l.jsxs)(e.li,{children:["在项目的 ios 目录下运行",(0,l.jsx)(e.code,{children:"pod install"})]}),"\n",(0,l.jsx)(e.li,{children:"重新编译"}),"\n"]})]}),(0,l.jsxs)(e.details,{children:[(0,l.jsx)(e.summary,{children:"RN < 0.60且不使用CocoaPods"}),(0,l.jsxs)(e.ol,{children:["\n",(0,l.jsxs)(e.li,{children:["在 XCode 中的 Project Navigator 里,右键点击",(0,l.jsx)(e.code,{children:"Libraries"})," ➜ ",(0,l.jsx)(e.code,{children:"Add Files to [你的工程名]"})]}),"\n",(0,l.jsxs)(e.li,{children:["进入",(0,l.jsx)(e.code,{children:"node_modules"})," ➜ ",(0,l.jsx)(e.code,{children:"react-native-update"})," ➜ ",(0,l.jsx)(e.code,{children:"ios 并选中"}),"RCTPushy.xcodeproj`"]}),"\n",(0,l.jsxs)(e.li,{children:["在 XCode 中的 project navigator 里,选中你的工程,在 ",(0,l.jsx)(e.code,{children:"Build Phases"})," ➜ ",(0,l.jsx)(e.code,{children:"Link Binary With Libraries"})," 中添加 ",(0,l.jsx)(e.code,{children:"libRCTPushy.a"}),"、",(0,l.jsx)(e.code,{children:"libz.tbd"}),"、",(0,l.jsx)(e.code,{children:"libbz2.1.0.tbd"})]}),"\n",(0,l.jsxs)(e.li,{children:["继续在",(0,l.jsx)(e.code,{children:"Build Settings"}),"里搜索",(0,l.jsx)(e.code,{children:"Header Search Path"}),",添加",(0,l.jsx)(e.code,{children:"$(SRCROOT)/../node_modules/react-native-update/ios"}),",勾选",(0,l.jsx)(e.code,{children:"recursive"}),"。"]}),"\n",(0,l.jsxs)(e.li,{children:["在",(0,l.jsx)(e.code,{children:"Build Phases"}),"添加一个",(0,l.jsx)(e.code,{children:"New Run Script Phase"}),"运行脚本,内容如下"]}),"\n"]}),(0,l.jsx)(e.pre,{"data-language":"text","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"text","data-theme":"default",children:[(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"#!/bin/bash"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"set -x"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:'DEST="../node_modules/react-native-update/ios/"'})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:'date +%s > "$DEST/pushy_build_time.txt"'})})]})}),(0,l.jsxs)(e.ol,{start:"7",children:["\n",(0,l.jsxs)(e.li,{children:["尝试编译一下,顺利的话就会在",(0,l.jsx)(e.code,{children:"../node_modules/react-native-update/ios/"}),"文件夹下面生成一个",(0,l.jsx)(e.code,{children:"pushy_build_time.txt"}),"文件。然后在",(0,l.jsx)(e.code,{children:"Copy Bundle Resources"}),"里把生成的",(0,l.jsx)(e.code,{children:"pushy_build_time.txt"}),"文件添加进去。"]}),"\n"]})]}),(0,l.jsx)(e.h4,{id:"android",children:"Android"}),(0,l.jsxs)(e.details,{children:[(0,l.jsx)(e.summary,{children:"RN < 0.60"}),(0,l.jsxs)(e.ol,{children:["\n",(0,l.jsxs)(e.li,{children:["\n",(0,l.jsxs)(e.p,{children:["在",(0,l.jsx)(e.code,{children:"android/settings.gradle"}),"中添加如下代码:"]}),"\n",(0,l.jsx)(e.pre,{"data-language":"text","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"text","data-theme":"default",children:[(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"include ':react-native-update'"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"project(':react-native-update').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-update/android')"})})]})}),"\n"]}),"\n",(0,l.jsxs)(e.li,{children:["\n",(0,l.jsxs)(e.p,{children:["在",(0,l.jsx)(e.code,{children:"android/app/build.gradle"}),"的 dependencies 部分增加如下代码:"]}),"\n",(0,l.jsx)(e.pre,{"data-language":"text","data-theme":"default",children:(0,l.jsx)(e.code,{"data-language":"text","data-theme":"default",children:(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"implementation project(':react-native-update')"})})})}),"\n"]}),"\n",(0,l.jsxs)(e.li,{children:["\n",(0,l.jsxs)(e.p,{children:["打开",(0,l.jsx)(e.code,{children:"android/app/src/main/java/[...]/MainApplication.java"}),","]}),"\n"]}),"\n"]}),(0,l.jsxs)(e.ul,{children:["\n",(0,l.jsxs)(e.li,{children:["在文件开头增加 ",(0,l.jsx)(e.code,{children:"import cn.reactnative.modules.update.UpdatePackage;"})]}),"\n",(0,l.jsxs)(e.li,{children:["在",(0,l.jsx)(e.code,{children:"getPackages()"})," 方法中增加 ",(0,l.jsx)(e.code,{children:"new UpdatePackage()"}),"(注意上一行可能要增加一个逗号)"]}),"\n"]})]}),(0,l.jsx)(e.h3,{id:"配置-bundle-url",children:"配置 Bundle URL"}),(0,l.jsx)(e.p,{children:"注意此步骤无论任何版本,目前都需要手动配置。"}),(0,l.jsx)(e.h4,{id:"ios-1",children:"iOS"}),(0,l.jsx)(e.p,{children:"在你的 AppDelegate.mm 或 AppDelegate.m 文件(不同 RN 版本可能后缀名不同)中增加如下代码:"}),(0,l.jsx)(e.pre,{"data-language":"c","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"c","data-theme":"default",children:[(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ... 其它代码"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"#import"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"AppDelegate.h"'})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"#import"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"RCTPushy.h"'}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// <-- import头文件,注意要放到if条件外面"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// 可能项目里有一些条件编译语句,例如有些版本RN自带的flipper"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// #if DEBUG"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:'// 注意**不要**在这里面引入"RCTPushy.h"'})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// #import "})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ..."})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// #endif"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// 修改sourceURLForBridge方法"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"-"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" (NSURL "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"*"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:")sourceURLForBridge:(RCTBridge "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"*"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:")bridge"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"{"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"#if"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"DEBUG"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// 原先DEBUG这里的写法不作修改(所以DEBUG模式下不可热更新)"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"index"'}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"];"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"#else"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" [RCTPushy bundleURL];"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:" // <-- 把这里非DEBUG的情况替换为热更新bundle"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"#endif"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"}"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "})]})}),(0,l.jsx)(e.h4,{id:"android-1",children:"Android"}),(0,l.jsxs)(e.p,{children:["在 MainApplication 中增加如下代码(如果是混编原生的项目或其他原因没有使用 ReactApplication,请",(0,l.jsx)(e.a,{href:"api#updatecontextsetcustominstancemanagerreactinstancemanager-instancemanager",children:"使用此 api 集成"}),"):"]}),(0,l.jsxs)(o.mQ,{items:["Kotlin","Java"],children:[(0,l.jsx)(o.mQ.Tab,{children:(0,l.jsx)(e.pre,{"data-language":"kotlin","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"kotlin","data-theme":"default",children:[(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ... 其它代码"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ↓↓↓请注意不要少了这句import"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" cn.reactnative.modules.update.UpdateContext;"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ↑↑↑"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"class"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"MainApplication"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" : "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"Application"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"(), "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"ReactApplication"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"override"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"val"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" reactNativeHost: "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"ReactNativeHost"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"="})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" object : "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"DefaultReactNativeHost"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"this"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:") {"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ↓↓↓将下面这一段添加到 DefaultReactNativeHost 内部!"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"override"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"fun"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"getJSBundleFile"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"(): "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"String"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"? {"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" UpdateContext."}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"getBundleUrl"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"this@MainApplication"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:")"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" }"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ↑↑↑"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ...其他代码"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" }"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})})}),(0,l.jsx)(o.mQ.Tab,{children:(0,l.jsx)(e.pre,{"data-language":"java","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"java","data-theme":"default",children:[(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ... 其它代码"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ↓↓↓请注意不要少了这句import"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"cn"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-punctuation)"},children:"."}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"reactnative"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-punctuation)"},children:"."}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"modules"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-punctuation)"},children:"."}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"update"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-punctuation)"},children:"."}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"UpdateContext"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ↑↑↑"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"public"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"class"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"MainApplication"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"extends"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"Application"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"implements"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"ReactApplication"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"private"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"final"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"ReactNativeHost"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" mReactNativeHost "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"="})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// 老版本 RN 这里可能是 new ReactNativeHost(this)"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"new"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"DefaultReactNativeHost("}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"this"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:")"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ↓↓↓将下面这一段添加到 DefaultReactNativeHost 内部!"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" @"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"Override"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"protected"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"String"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"getJSBundleFile"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"() {"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"UpdateContext"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-punctuation)"},children:"."}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"getBundleUrl"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"MainApplication"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-punctuation)"},children:"."}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"this"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" }"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ↑↑↑"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"// ...其他代码"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" }"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})})})]}),(0,l.jsx)(o.UW,{type:"info",children:(0,l.jsx)(e.p,{children:"请记得,任意在 ios 和 android 目录下的修改,一定要重新编译(npx react-native\nrun-ios 或 run-android 命令编译,或在 Xcode/Android Studio\n中重新编译)才能生效。"})}),(0,l.jsx)(e.h3,{id:"禁用-android-的-crunch-优化",children:"禁用 android 的 crunch 优化"}),(0,l.jsxs)(e.p,{children:["android 会在生成 apk 时自动对 png 图片进行压缩,此操作既耗时又影响增量补丁的生成。为了保证补丁能正常生成,您需要在",(0,l.jsx)(e.code,{children:"android/app/build.gradle"}),"中关闭此操作:"]}),(0,l.jsx)(e.pre,{"data-language":"gradle","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"gradle","data-theme":"default",children:[(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"..."})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"android {"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" ..."})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" signingConfigs { ... }"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" buildTypes {"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" release {"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" ..."})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" // 添加下面这行以禁用crunch"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" crunchPngs false"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" }"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" }"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"}"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"..."})})]})}),(0,l.jsx)(e.h3,{id:"登录与创建应用",children:"登录与创建应用"}),(0,l.jsxs)(e.p,{children:["首先请在 ",(0,l.jsx)(e.a,{href:"https://update.reactnative.cn",children:"https://update.reactnative.cn"})," 注册帐号,然后在你的项目根目录下运行以下命令:"]}),(0,l.jsx)(e.pre,{"data-language":"bash","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"bash","data-theme":"default",children:[(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"$"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"pushy"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"login"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"email:"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"<"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"输入你的注册邮"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"箱"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:">"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"password:"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"<"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"输入你的密"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"码"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:">"})]})]})}),(0,l.jsxs)(e.p,{children:["这会在项目文件夹下创建一个",(0,l.jsx)(e.code,{children:".update"}),"文件,注意不要把这个文件上传到 Git 等 CVS 系统上。你可以在",(0,l.jsx)(e.code,{children:".gitignore"}),"末尾增加一行",(0,l.jsx)(e.code,{children:".update"}),"来忽略这个文件。"]}),(0,l.jsx)(e.p,{children:"登录之后可以创建应用。注意 iOS 平台和安卓平台需要分别创建:"}),(0,l.jsx)(e.pre,{"data-language":"bash","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"bash","data-theme":"default",children:[(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"$"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"pushy"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"createApp"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"--platform"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"ios"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"App"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"Name:"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"<"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"输入应用名"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"字"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:">"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"$"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"pushy"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"createApp"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"--platform"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"android"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"App"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"Name:"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"<"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"输入应用名"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"字"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:">"})]})]})}),(0,l.jsx)(o.UW,{type:"info",children:"两次输入的名字可以相同,这没有关系。"}),(0,l.jsx)(e.p,{children:"如果你已经在网页端或者其它地方创建过应用,也可以直接选择应用:"}),(0,l.jsx)(e.pre,{"data-language":"bash","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"bash","data-theme":"default",children:[(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"$"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"pushy"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"selectApp"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"--platform"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"ios"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"1"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:") 鱼多多("}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"ios"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:")"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"2"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:") 招财旺("}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"ios"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:")"})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:" "}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"Total"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"2"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"ios"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"apps"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"Enter"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"appId:"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"<"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"输入应用前面的编"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"号"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:">"})]})]})}),(0,l.jsxs)(e.p,{children:["选择或者创建过应用后,你将可以在文件夹下看到",(0,l.jsx)(e.code,{children:"update.json"}),"文件,其内容类似如下形式:"]}),(0,l.jsx)(e.pre,{"data-language":"bash","data-theme":"default",children:(0,l.jsxs)(e.code,{"data-language":"bash","data-theme":"default",children:[(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"{"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:'"ios"'}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:":"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"{"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:'"appId"'}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:":"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"1"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:","})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:'"appKey"'}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:":"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"<一串随机字符串>"'})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" },"})}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:'"android"'}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:":"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:"{"})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:'"appId"'}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:":"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"2"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string)"},children:","})]}),"\n",(0,l.jsxs)(e.span,{className:"line",children:[(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:'"appKey"'}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:":"}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,l.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"<一串随机字符串>"'})]}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" }"})}),"\n",(0,l.jsx)(e.span,{className:"line",children:(0,l.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),(0,l.jsxs)(e.p,{children:["你可以安全的把",(0,l.jsx)(e.code,{children:"update.json"}),"上传到 Git 等 CVS 系统上,与你的团队共享这个文件,它不包含任何敏感信息。当然,他们在使用任何功能之前,都必须首先输入",(0,l.jsx)(e.code,{children:"pushy login"}),"进行登录。"]}),(0,l.jsxs)(e.p,{children:["至此应用的创建/选择就已经成功了。下一步,你需要给代码添加相应的功能,请参阅",(0,l.jsx)(e.a,{href:"integration",children:"代码集成"}),"。"]})]})]})}function t(s,e){throw Error("Expected "+(e?"component":"object")+" `"+s+"` to be defined: you likely forgot to import, pass, or provide it.")}e.default=(0,i.j)({MDXContent:function(){let s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,r.a)(),s.components);return e?(0,l.jsx)(e,{...s,children:(0,l.jsx)(c,{...s})}):c(s)},pageOpts:{filePath:"pages/docs/getting-started.mdx",route:"/docs/getting-started",frontMatter:{order:0,title:"安装配置",type:"快速入门"},title:"安装配置",headings:a},pageNextRoute:"/docs/getting-started"})}},function(s){s.O(0,[567,888,774,179],function(){return s(s.s=30876)}),_N_E=s.O()}]); \ No newline at end of file diff --git a/docs/api.html b/docs/api.html index 990faf9..814ac65 100644 --- a/docs/api.html +++ b/docs/api.html @@ -11,7 +11,7 @@ --nextra-primary-hue: 204deg; --nextra-primary-saturation: 100%; } -
文档
API参考

JavaScript 方法

+
文档
API参考

JavaScript 方法

new Pushy(options: PushyOptions)

创建 Pushy 热更新服务实例,其构造参数如下:

interface PushyOptions {
@@ -246,4 +246,4 @@ 

// ...各种setter,但注意不要调用setBundleAssetName .setJSBundleFile(UpdateContext.getBundleUrl(mContext, "assets://index.android.bundle")) .build(); -UpdateContext.setCustomInstanceManager(mReactInstanceManager);

\ No newline at end of file +UpdateContext.setCustomInstanceManager(mReactInstanceManager);
\ No newline at end of file diff --git a/docs/bestpractice.html b/docs/bestpractice.html index cb19fc3..4f08663 100644 --- a/docs/bestpractice.html +++ b/docs/bestpractice.html @@ -11,7 +11,7 @@ --nextra-primary-hue: 204deg; --nextra-primary-saturation: 100%; } -
文档
场景实践

优化原生和热更包体积

+
文档
场景实践

优化原生和热更包体积

iOS 原生包优化(ipa)

对于同一份 archive(其版本号、编译时间和内置 bundle 已固定,不会受导出方式所影响),可以用不同选项多次导出 ipa,选择其中最小的上传到 pushy 服务器作为热更基准包。

bitcode

@@ -93,4 +93,4 @@

// 否则还是走之前的询问流程 // Alert.alert('提示', '检查到新的版本....... }

-

又比如,可能某个版本包含一些重要的公告内容,所以还可以在上面插入一个公告字段等等。如何使用元信息,完全取决于您的想象力!

\ No newline at end of file +

又比如,可能某个版本包含一些重要的公告内容,所以还可以在上面插入一个公告字段等等。如何使用元信息,完全取决于您的想象力!

\ No newline at end of file diff --git a/docs/changelog.html b/docs/changelog.html index c1020a0..d7872c7 100644 --- a/docs/changelog.html +++ b/docs/changelog.html @@ -11,7 +11,7 @@ --nextra-primary-hue: 204deg; --nextra-primary-saturation: 100%; } -
文档
更新日志

10.1.0(2024-02-24)

+
文档
更新日志

10.1.0(2024-02-24)

  • 全新设计的 api 接口,全面 hook 化,更易集成和自定义
  • 全面同时支持新老架构和 hermes
  • @@ -169,4 +169,4 @@

  • 解决 Android 热更新后部分图片丢失问题:
    同一个项目中放置了多个完全相同的文件,在 5.1.0 至 5.1.5 之间的版本中,更新后有时会出现其中的部分无法显示。此问题在 5.1.6 版本修复。修复此问题涉及原生部分,需要重新打包。
  • -

\ No newline at end of file +
\ No newline at end of file diff --git a/docs/cli.html b/docs/cli.html index 2de3a65..3c46daf 100644 --- a/docs/cli.html +++ b/docs/cli.html @@ -11,7 +11,7 @@ --nextra-primary-hue: 204deg; --nextra-primary-saturation: 100%; } -
文档
命令行工具

安装

+
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/faq.html b/docs/faq.html index c383408..7882c9c 100644 --- a/docs/faq.html +++ b/docs/faq.html @@ -11,7 +11,7 @@ --nextra-primary-hue: 204deg; --nextra-primary-saturation: 100%; } -
文档
常见问题

如果本页面没能回答您的疑问,您可以去issues 区 (opens in a new tab)或 QQ 群 729013783 提问,或给我们发邮件

+
文档
常见问题

如果本页面没能回答您的疑问,您可以去issues 区 (opens in a new tab)或 QQ 群 729013783 提问,或给我们发邮件

业务问题

热更新究竟能否上架?

您可能听说过各种说法,但大量实践表明,热更新目前能够顺利上架 AppStore 和其他各种应用市场。唯一需要注意的是,在审核期间请不要发布热更新,不要让审核人员看到各种更新相关的提示和弹窗,即可顺利通过。

@@ -107,4 +107,4 @@

可以按月付款吗?

需要月付的客户请联系 QQ 客服 34731408,月付价格为年付价格 / 8。如标准版当前价格为 800 元每年,则月付价格为 100 元每月。 月付客户需累计支付满 500 元后才能开具发票。

-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/getting-started.html b/docs/getting-started.html index 003e335..ffdda89 100644 --- a/docs/getting-started.html +++ b/docs/getting-started.html @@ -11,7 +11,7 @@ --nextra-primary-hue: 204deg; --nextra-primary-saturation: 100%; } -
文档
安装配置

请注意,当前版本的api经过了完全重构,与之前的版本(v10.0以下)不兼容。如果你需要查看之前版本的文档,请点击这里 (opens in a new tab)

+
文档
安装配置

请注意,当前版本的api经过了完全重构,与之前的版本(v10.0以下)不兼容。如果你需要查看之前版本的文档,请点击这里 (opens in a new tab)

首先你应该有一个基于 React Native 开发的应用,我们把具有 package.json 的目录叫做你的应用根目录。 如果你还没有初始化应用,请参阅开始使用 React Native (opens in a new tab)

我们假设你已经拥有了开发 React Native 应用的一切环境,包括Node.jsXcodeAndroid SDK等等。

@@ -25,7 +25,7 @@ cd ios && pod install

如果下载极慢或者显示网络失败,请设置使用淘宝镜像 npx nrm use taobao

⚠️

注意请不要混用npm/yarn/pnpm等包管理器及对应的lock文件,团队成员请坚持使用同一包管理器,且仅保留统一格式的lock文件

请记得,任意在 ios 和 android 目录下的修改,一定要重新编译(使用 npx react-native run-ios 或 run-android 命令编译,或在 Xcode/Android Studio -中重新编译)才能生效。

手动 link

如果 RN 版本 >= 0.60 则不需要此手动 link 步骤。

注意:如果是混编 RN +中重新编译)才能生效。

手动 link

如果 RN 版本 >= 0.60 则不需要此手动 link 步骤。

⚠️

注意:如果是混编 RN 项目,或monorepo,或任何其他自定义的情况,由于自定义的配置可能不完整或不适应RN的目录结构,导致自动 link 的功能可能不能正常工作。此时即便 RN 版本 >= 0.60,你可能也需要执行手动 link 操作。

iOS

RN < 0.60且使用CocoaPods(推荐)
    @@ -135,4 +135,4 @@ "appId": 2, "appKey": "<一串随机字符串>" } -}

你可以安全的把update.json上传到 Git 等 CVS 系统上,与你的团队共享这个文件,它不包含任何敏感信息。当然,他们在使用任何功能之前,都必须首先输入pushy login进行登录。

至此应用的创建/选择就已经成功了。下一步,你需要给代码添加相应的功能,请参阅代码集成

\ No newline at end of file +}

你可以安全的把update.json上传到 Git 等 CVS 系统上,与你的团队共享这个文件,它不包含任何敏感信息。当然,他们在使用任何功能之前,都必须首先输入pushy login进行登录。

至此应用的创建/选择就已经成功了。下一步,你需要给代码添加相应的功能,请参阅代码集成

\ No newline at end of file diff --git a/docs/integration.html b/docs/integration.html index 1f166b2..7c26f37 100644 --- a/docs/integration.html +++ b/docs/integration.html @@ -11,7 +11,7 @@ --nextra-primary-hue: 204deg; --nextra-primary-saturation: 100%; } -
文档
代码集成

请注意,当前版本的api经过了完全重构,与之前的版本(v10.0以下)不兼容。如果你需要查看之前版本的文档,请点击这里 (opens in a new tab)

+
文档
代码集成

请注意,当前版本的api经过了完全重构,与之前的版本(v10.0以下)不兼容。如果你需要查看之前版本的文档,请点击这里 (opens in a new tab)

安装配置完成后,确定应用编译顺利通过,下面我们来进行代码集成。

获取 appKey

检查更新时必须提供你的appKey,这个值保存在update.json中(使用pushy createApppushy selectApp命令后会自动生成),并且根据平台不同而不同。你可以用如下的代码获取appKey

@@ -138,4 +138,4 @@

}, });

以上提及的所有 api 的说明文档可在这里查看。

-

现在,你的应用已经可以通过 pushy 服务检查版本并进行更新了。下一步,你可以开始尝试发布应用包和版本,请参阅发布热更新

\ No newline at end of file +

现在,你的应用已经可以通过 pushy 服务检查版本并进行更新了。下一步,你可以开始尝试发布应用包和版本,请参阅发布热更新

\ No newline at end of file diff --git a/docs/publish.html b/docs/publish.html index 107a894..b8951c1 100644 --- a/docs/publish.html +++ b/docs/publish.html @@ -11,7 +11,7 @@ --nextra-primary-hue: 204deg; --nextra-primary-saturation: 100%; } -
文档
发布流程

现在你的应用已经具备了检测更新的功能,下面我们来尝试发布并更新它。流程可参考下图:

+
文档
发布流程

现在你的应用已经具备了检测更新的功能,下面我们来尝试发布并更新它。流程可参考下图:

流程总结如下:

    @@ -81,4 +81,4 @@

    我们强烈建议您先发布一个测试包,再发布一个除了版本号以外均完全相同的正式包

    例如,假设我们有一个正式包,版本为1.6.0,那么可以修改版本号重新打包一个1001.6.0,以一个明显不太正常的版本号来标识它是一个测试版本,同时后几位相同,可以表明它和某个正式版本存在关联(内容/依赖一致)。

    在每次往发布包发起热更新之前,先对测试包1001.6.0进行更新操作,基本测试通过之后,再在网页后台上将热更包重新绑定到正式包1.6.0上。如果在测试包中发现了重大问题,你就可以先进行修复,更新测试确认通过后再部署到正式线上环境。这样,可以最大程度的避免发生线上事故。

    -

    万一确实发生线上事故需要回滚的话,首先利用版本控制系统回滚代码到正常的状态,然后重新生成热更包并推送即可。

\ No newline at end of file +

万一确实发生线上事故需要回滚的话,首先利用版本控制系统回滚代码到正常的状态,然后重新生成热更包并推送即可。

\ No newline at end of file diff --git a/index.html b/index.html index d377996..997caff 100644 --- a/index.html +++ b/index.html @@ -11,4 +11,4 @@ --nextra-primary-hue: 204deg; --nextra-primary-saturation: 100%; } -

他们选择了 Pushy

网易游戏
蓝月亮
华中师范大学
娇兰佳人
平安不动产
友车科技
诺安基金
锐捷网络
航天信息
天津公交
Feature

为什么选择 Pushy

  • img

    增量更新

    基于 bsdiff/hdiff 算法创建

    kb 级别超小更新包

  • img

    快捷发布

    命令行工具 & 网页双端管理

    支持CI部署

  • img

    极速下载

    基于阿里云高速CDN分发

    全国范围秒速更新

  • img

    稳定可靠

    自带崩溃回滚机制

    安全可靠

  • img

    灵活扩展

    开放定制元信息

    提供灵活自由的更新策略

  • img

    技术支持

    遇到技术问题?

    工作时间段内小时级别响应

    Icons made by Swifticons from www.flaticon.com

    Let’s Pushy

    # 安装
    $ npm i -g react-native-update-cli
    $ npm i react-native-update && cd ios && pod install

    # 上传原生基础包
    $ pushy uploadIpa yourApp.ipa
    $ pushy uploadApk yourApp.apk

    # 生成并上传热更包
    $ pushy bundle --platform android
    $ pushy bundle --platform ios
    查看文档
    \ No newline at end of file +

    他们选择了 Pushy

    网易游戏
    蓝月亮
    华中师范大学
    娇兰佳人
    平安不动产
    友车科技
    诺安基金
    锐捷网络
    航天信息
    天津公交
    Feature

    为什么选择 Pushy

    • img

      增量更新

      基于 bsdiff/hdiff 算法创建

      kb 级别超小更新包

    • img

      快捷发布

      命令行工具 & 网页双端管理

      支持CI部署

    • img

      极速下载

      基于阿里云高速CDN分发

      全国范围秒速更新

    • img

      稳定可靠

      自带崩溃回滚机制

      安全可靠

    • img

      灵活扩展

      开放定制元信息

      提供灵活自由的更新策略

    • img

      技术支持

      遇到技术问题?

      工作时间段内小时级别响应

      Icons made by Swifticons from www.flaticon.com

      Let’s Pushy

      # 安装
      $ npm i -g react-native-update-cli
      $ npm i react-native-update && cd ios && pod install

      # 上传原生基础包
      $ pushy uploadIpa yourApp.ipa
      $ pushy uploadApk yourApp.apk

      # 生成并上传热更包
      $ pushy bundle --platform android
      $ pushy bundle --platform ios
      查看文档
      \ No newline at end of file diff --git a/pricing.html b/pricing.html index 1d7c377..ece3606 100644 --- a/pricing.html +++ b/pricing.html @@ -11,4 +11,4 @@ --nextra-primary-hue: 204deg; --nextra-primary-saturation: 100%; } -

      新注册用户将自动获得7 天专业版免费试用评估。到期后转为免费版。如需按月购买,请联系QQ客服 34731408.

      免费版

      适用于小型应用,轻度更新需求

      0 / 年
      开始使用

      标准版

      适用于一般应用,中度更新需求

      800/ 年
      100/ 月
      • 可创建5个应用 ,每个限*:
      • 50个原生包,每个最大150M
      • 50个热更包,每个最大15M
      • 提供专人技术支持
      立即升级

      高级版

      适用于一般应用,中度更新需求

      2400/ 年
      300/ 月
      • 可创建10个应用,每个限*:
      • 60个原生包,每个最大500M
      • 60个热更包,每个最大50M
      • 提供专人技术支持
      立即升级

      专业版

      适用于商业应用,高速迭代需求

      7200/ 年
      900/ 月
      • 可创建20个应用,每个限*:
      • 100个原生包,每个最大2000M
      • 100个热更包,每个最大200M
      • 提供专人技术支持
      立即升级

      如您需要更高配额,我们也提供定制版本或是私有服务器部署,您可将具体需求发送至 hi@charmlot.com 我们将第一时间回复。

      *注:iOS 和 Android 版本记做不同的应用。
      原生包指完整的apk/ipa安装包。热更包指pushy bundle命令生成的ppk文件(不是用户实际下载的增量更新文件)。
      您可删除已不再使用的应用、原生包、热更包来有效利用配额。

      对于付费业务还有其他疑问?请参考常见问题

      \ No newline at end of file +

      新注册用户将自动获得7 天专业版免费试用评估。到期后转为免费版。如需按月购买,请联系QQ客服 34731408.

      免费版

      适用于小型应用,轻度更新需求

      0 / 年
      开始使用

      标准版

      适用于一般应用,中度更新需求

      800/ 年
      100/ 月
      • 可创建5个应用 ,每个限*:
      • 50个原生包,每个最大150M
      • 50个热更包,每个最大15M
      • 提供专人技术支持
      立即升级

      高级版

      适用于一般应用,中度更新需求

      2400/ 年
      300/ 月
      • 可创建10个应用,每个限*:
      • 60个原生包,每个最大500M
      • 60个热更包,每个最大50M
      • 提供专人技术支持
      立即升级

      专业版

      适用于商业应用,高速迭代需求

      7200/ 年
      900/ 月
      • 可创建20个应用,每个限*:
      • 100个原生包,每个最大2000M
      • 100个热更包,每个最大200M
      • 提供专人技术支持
      立即升级

      如您需要更高配额,我们也提供定制版本或是私有服务器部署,您可将具体需求发送至 hi@charmlot.com 我们将第一时间回复。

      *注:iOS 和 Android 版本记做不同的应用。
      原生包指完整的apk/ipa安装包。热更包指pushy bundle命令生成的ppk文件(不是用户实际下载的增量更新文件)。
      您可删除已不再使用的应用、原生包、热更包来有效利用配额。

      对于付费业务还有其他疑问?请参考常见问题

      \ No newline at end of file