代码拉取完成,页面将自动刷新
【问题描述】
我在pubspec.yaml 配置文件中,配置了鸿蒙的适配包,中间为了解决编译问题,注释了一些包,执行flutter clean & flutter pub get后,ohos项目中的oh_packages.json5不会自动的清理我注释的包,貌似只能增加不能减少。
【我的环境】
MacOS 15.1 M2芯片
【最后解决】
需要手动的从oh_packages.json5文件中删除我在pubspec.yaml中注释的对应的包配置。
【诉求】
希望大佬们验证一下,flutter clean & flutter pub get 不能自动清理和自动配置问题,说明一下情况。
【我的pubspec.yaml文件】
由于配图违规,这里附上我的配置文件
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
cupertino_icons: ^1.0.6
# 鸿蒙已适配版本
path_provider: ^2.1.1 #沙盒存储
shared_preferences: ^2.2.2 #本地轻量数据存储
file_selector: ^1.0.1 #文件选择器
image_picker: ^1.0.4 #媒体文件选择器
animations: ^2.0.8 #动画
url_launcher: ^6.1.11 #打开网页、电话、短信、邮件
local_auth: ^2.1.6 #生物识别
webview_flutter: ^4.4.4 #网页加载
connectivity_plus: ^5.0.2 #网络检测
device_info_plus: ^9.1.2 #获取设备信息
network_info_plus: ^6.0.0 #网络信息
package_info_plus: ^4.2.0 #获取应用信息
share_plus: ^7.2.2 #获取应用信息
audioplayers: ^4.1.0 #声音播放
flutter_keyboard_visibility: ^6.0.0 #键盘显示隐藏
flutter_local_notifications: ^18.0.1 #本地通知
in_app_purchase: ^3.1.11 #订阅内购
sqflite: ^2.2.8+4 #db数据库
open_app_settings: ^2.0.1
# permission_handler: ^11.3.1 #权限处理
dependency_overrides:
# 鸿蒙适配库
path_provider:
git:
url: "https://gitee.com/openharmony-sig/flutter_packages.git"
path: "packages/path_provider/path_provider"
shared_preferences:
git:
url: "https://gitee.com/openharmony-sig/flutter_packages.git"
path: "packages/shared_preferences/shared_preferences"
# image_picker:
# git:
# url: "https://gitee.com/openharmony-sig/flutter_packages.git"
# path: "packages/image_picker/image_picker"
# file_selector:
# git:
# url: "https://gitee.com/openharmony-sig/flutter_packages.git"
# path: "packages/file_selector/file_selector"
# animations:
# git:
# url: "https://gitee.com/openharmony-sig/flutter_packages.git"
# path: "packages/animations"
url_launcher:
git:
url: "https://gitee.com/openharmony-sig/flutter_packages.git"
path: "packages/url_launcher/url_launcher"
# local_auth:
# git:
# url: "https://gitee.com/openharmony-sig/flutter_packages.git"
# path: "packages/local_auth/local_auth"
in_app_purchase:
git:
url: "https://gitee.com/openharmony-sig/flutter_packages.git"
path: "packages/in_app_purchase/in_app_purchase"
webview_flutter:
git:
url: "https://gitee.com/openharmony-sig/flutter_packages.git"
path: "packages/webview_flutter-v4.4.4/webview_flutter"
connectivity_plus:
git:
url: "https://gitee.com/openharmony-sig/flutter_plus_plugins.git"
path: "packages/connectivity_plus/connectivity_plus"
device_info_plus:
git:
url: "https://gitee.com/openharmony-sig/flutter_plus_plugins.git"
path: "packages/device_info_plus/device_info_plus"
# network_info_plus:
# git:
# url: "https://gitee.com/openharmony-sig/flutter_plus_plugins.git"
# path: "packages/network_info_plus/network_info_plus"
package_info_plus:
git:
url: "https://gitee.com/openharmony-sig/flutter_plus_plugins.git"
path: "packages/package_info_plus/package_info_plus"
share_plus:
git:
url: "https://gitee.com/openharmony-sig/flutter_plus_plugins.git"
path: "packages/share_plus/share_plus"
# battery_plus:
# git:
# url: "https://gitee.com/openharmony-sig/flutter_plus_plugins.git"
# path: "packages/battery_plus/battery_plus"
audioplayers:
git:
url: "https://gitee.com/openharmony-sig/flutter_audioplayers.git"
path: "packages/audioplayers"
flutter_keyboard_visibility:
git:
url: "https://gitee.com/openharmony-sig/flutter_keyboard_visibility.git"
path: "flutter_keyboard_visibility"
# flutter_local_notifications:
# git:
# url: "https://gitee.com/openharmony-sig/fluttertpc_flutter_local_notifications.git"
# path: "flutter_local_notifications"
sqflite:
git:
url: "https://gitee.com/openharmony-sig/flutter_sqflite.git"
path: "sqflite"
# permission_handler:
# git:
# url: "https://gitee.com/openharmony-sig/flutter_permission_handler.git"
# path: "permission_handler"
open_app_settings:
git:
url: "https://gitee.com/openharmony-sig/fluttertpc_open_app_settings.git"
path: ""
在未自定义ohos的情况下,运行鸿蒙项目会生成.ohos的文件目录,这种情况下执行flutter clean的话,会自动清理所有的依赖项。
在自定义了ohos的情况下,运行鸿蒙项目则不会再次生成.ohos文件目录了,这种情况下开发者会对项目进行源码修改,增加自定义的依赖项和相关配置,这种情况下执行flutter clean去清理依赖项显然不再合适了,因为依赖项不完全在pubspec.yaml文件中,也有可能是伙伴自己配置的源码依赖。
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
登录 后才可以发表评论