在Flutter:打包apk,详细图文介绍(一)基础上,实现安卓端的版本更新功能。
1、把自己的demo文件复制到空项目中
2、生成APP图标:dart run icons_launcher:create
3、生成启动图:dart run flutter_native_splash:create
只是查看怎么在安卓端更新apk可忽略1-3步骤,
这些是安装更新需要用到的依赖
# apk安装插件
app_installer: ^1.3.1
# 获取安装包路径
path_provider: ^2.1.5
# 接口请求
dio: ^5.7.0
pubspec.yaml
name: demo
description: "A new Flutter project."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1
environment:
sdk: ^3.5.4
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
# 多语言开启
flutter_localizations:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
# 状态管理
get: ^4.6.6
# apk安装插件
app_installer: ^1.3.1
# 获取安装包路径
path_provider: ^2.1.5
# 包信息
package_info_plus: ^8.1.1
# 离线存储
shared_preferences: ^2.3.3
# 接口请求
dio: ^5.7.0
# 猫哥封装基础组件,已包含配模适配ScreenUtil插件,可直接设置宽高.w,字体大小.sp
ducafe_ui_core: ^1.0.4
# 图片缓存
cached_network_image: ^3.4.1
# svg
flutter_svg: ^2.0.16
#轮播
carousel_slider: ^5.0.0
# ui
tdesign_flutter: ^0.1.7
# 下拉刷新
pull_to_refresh_flutter3: ^2.0.2
# 加载动画
flutter_easyloading: ^3.0.5
# 城市选择
city_pickers: ^1.3.0
# 徽章
badges: ^3.1.2
# 主题切换
adaptive_theme: ^3.6.0
# 图片、视频选取
extended_image: ^8.3.1
# wechat_assets_picker: ^9.3.2
# wechat_camera_picker: ^4.3.2
# 图片预览
photo_view: ^0.15.0
# 网页
# webview_flutter: ^4.10.0
# 二维码
qr_flutter: ^4.1.0
# 二维码扫描
mobile_scanner: