Flutter 热修复(Shorebird)

马肤
这是懒羊羊

Shorebird:https://docs.shorebird.dev/

我们都知道安卓原生开发,热修复已经不是什么难题。阿里云,腾讯云已经都有现成的SDK可以接入。

然而Flutter开发还一直没有类似热修复的开发库,无意中看到了Shorebird这个平台,接下来就开始学习一波。

一.准备工作

1.安装Shorebird

Window系统

打开 PowerShell 终端并运行:

Set-ExecutionPolicy RemoteSigned -scope CurrentUser # Needed to execute remote scripts
iwr -UseBasicParsing 'https://raw.githubusercontent.com/shorebirdtech/install/main/install.ps1'|iex

Flutter 热修复(Shorebird),在这里插入图片描述,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,没有,安装,进行,第1张安装完成后验证一下:

打开普通终端运行命令:shorebird doctor

Flutter 热修复(Shorebird),在这里插入图片描述,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,没有,安装,进行,第2张

苹果系统运行命令如下:

curl --proto '=https' --tlsv1.2 https://raw.githubusercontent.com/shorebirdtech/install/main/install.sh -sSf | bash

2.登录

执行以下命令:

shorebird login

登录验证的时候,会让你选择使用哪个浏览器进行验证,Google和Microsoft。

由于Google账号验证有问题,所以选择的是Microsoft验证。

Flutter 热修复(Shorebird),在这里插入图片描述,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,没有,安装,进行,第3张

二.项目构建

1.初始化

要将现有 Flutter 项目配置为使用 Shorebird,请shorebird init 在 Flutter 项目的根目录下使用:

shorebird init

Flutter 热修复(Shorebird),在这里插入图片描述,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,没有,安装,进行,第4张

2.初始化包

项目开始打包:

shorebird release android

打包完默认生成的是aab格式的包

Flutter 热修复(Shorebird),在这里插入图片描述,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,没有,安装,进行,第5张

也可以改成apk的形式

shorebird release android --artifact apk

也可以指定发布的flutter版本

shorebird release android --flutter-version 3.19.0

Flutter 热修复(Shorebird),在这里插入图片描述,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,没有,安装,进行,第6张

以上就把包初始化完成了,这个算是第一个基础包(注意:这个包必须要安装,不然后续没法热更新),后边热修复会进行打差分包。

3.补丁包

上边打的包安装后,可以修改代码,打补丁包

shorebird patch android

Flutter 热修复(Shorebird),在这里插入图片描述,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,没有,安装,进行,第7张

理论上执行完命令后,补丁就已经发布了。重新打开app就可以看到更新了。

三.控制台

用Microsoft浏览器打开:https://console.shorebird.dev/

在这里可以看到构建的版本,和打过的补丁包。

Flutter 热修复(Shorebird),在这里插入图片描述,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,没有,安装,进行,第8张


文章版权声明:除非注明,否则均为VPS857原创文章,转载或复制请以超链接形式并注明出处。

发表评论

快捷回复:表情:
评论列表 (暂无评论,0人围观)

还没有评论,来说两句吧...

目录[+]

取消
微信二维码
微信二维码
支付宝二维码