HarmonyOS 鸿蒙Next flutter支持鸿蒙项目 引用path_provider 在android studio跑真机无法启动app
HarmonyOS 鸿蒙Next flutter支持鸿蒙项目 引用path_provider 在android studio跑真机无法启动app
flutter支持鸿蒙项目 引用path_provide 在android studio 跑真机 无法启动app
name: traffic_app
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: ‘>=2.19.6 <3.0.0’
# 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
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
path_provider:
git:
url: “https://gitee.com/openharmony-sig/flutter_packages.git”
path: “packages/path_provider/path_provider”
dev_dependencies:
flutter_test:
sdk: flutter
# The “flutter_lints” package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the analysis_options.yaml
file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific “variants”, see
# https://flutter.dev/assets-and-images/#resolution-aware
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this “flutter” section. Each entry in this list should have a
# “family” key with the font family name, and a “fonts” key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
Device info:HUAWEI Mate 60 Pro
Build info:ALN-AL00 5.0.0.113(SP2C00E110R4P22log)
Fingerprint:1871372abdcb839a677bca41c10b8577b41939a9c2d16ace08d2c9590619d43e
Module name:com.example.traffic_app
Version:1.0.0
VersionCode:1
PreInstalled:No
Foreground:No
Pid:40246
Uid:20020179
Reason:ReferenceError
Error name:ReferenceError
Error message:cannot find record ‘pkg_modules/.ohpm/path_provider_ohos@r1d6c7n69ammbkppyobz5ltuxq0zhtma6crnkc83ca8=/pkg_modules/path_provider_ohos/index’, please check the request path.’/data/storage/el1/bundle/entry/ets/modules.abc’.
Stacktrace:
SourceMap is not initialized yet
#00 pc 00000000006d67cc /system/lib64/platformsdk/libark_jsruntime.so(0a5e5a08ab1e8b1f274b227e2dc8bb96)
#01 pc 00000000006d6d40 /system/lib64/platformsdk/libark_jsruntime.so(0a5e5a08ab1e8b1f274b227e2dc8bb96)
#02 pc 00000000003219a8 /system/lib64/platformsdk/libark_jsruntime.so(0a5e5a08ab1e8b1f274b227e2dc8bb96)
#03 pc 00000000001b97ec /system/lib64/platformsdk/libark_jsruntime.so(0a5e5a08ab1e8b1f274b227e2dc8bb96)
#04 pc 00000000001b927c /system/lib64/platformsdk/libark_jsruntime.so(0a5e5a08ab1e8b1f274b227e2dc8bb96)
#05 pc 000000000024c420 /system/lib64/platformsdk/libark_jsruntime.so(0a5e5a08ab1e8b1f274b227e2dc8bb96)
#06 pc 00000000005c2590 /system/lib64/platformsdk/libark_jsruntime.so(0a5e5a08ab1e8b1f274b227e2dc8bb96)
#07 pc 00000000005bd754 /system/lib64/platformsdk/libark_jsruntime.so(0a5e5a08ab1e8b1f274b227e2dc8bb96)
#08 pc 0000000000560c18 /system/lib64/platformsdk/libark_jsruntime.so(0a5e5a08ab1e8b1f274b227e2dc8bb96)
#09 pc 0000000000551470 /system/lib64/platformsdk/libark_jsruntime.so(0a5e5a08ab1e8b1f274b227e2dc8bb96)
#10 pc 00000000005567a8 /system/lib64/platformsdk/libark_jsruntime.so(0a5e5a08ab1e8b1f274b227e2dc8bb96)
#11 pc 00000000005565a0 /system/lib64/platformsdk/libark_jsruntime.so(0a5e5a08ab1e8b1f274b227e2dc8bb96)
#12 pc 00000000005567e4 /system/lib64/platformsdk/libark_jsruntime.so(0a5e5a08ab1e8b1f274b227e2dc8bb96)
#13 pc 00000000005565a0 /system/lib64/platformsdk/libark_jsruntime.so(0a5e5a08ab1e8b1f274b227e2dc8bb96)
#14 pc 0000000000556084 /system/lib64/platformsdk/libark_jsruntime.so(0a5e5a08ab1e8b1f274b227e2dc8bb96)
#15 pc 0000000000430d98 /system/lib64/platformsdk/libark_jsruntime.so(0a5e5a08ab1e8b1f274b227e2dc8bb96)
更多关于HarmonyOS 鸿蒙Next flutter支持鸿蒙项目 引用path_provider 在android studio跑真机无法启动app的实战系列教程也可以访问 https://www.itying.com/category-92-b0.html
更多关于HarmonyOS 鸿蒙Next flutter支持鸿蒙项目 引用path_provider 在android studio跑真机无法启动app的实战系列教程也可以访问 https://www.itying.com/category-92-b0.html
尝试以下解决方法:
1、可能是pub cache默认的路径太长了,需要设置短一点的路径
修改环境变量 PUB_CACHE,重启IDE或终端后再编译运行
PUB_CACHE = D:\cache\pub
2、更新flutter的dev分支到最新版本,清除flutter工程的各种缓存和flutter的/bin/cache目录,重新下载依赖,编译后再试下
先在ohos目录下执行一下 hvigorw clean,然后再执行 flutter 的编译命令
在HarmonyOS鸿蒙Next环境中使用Flutter开发时,若遇到在Android Studio中通过真机运行引用path_provider
插件后无法启动App的问题,可能是由于以下几个原因:
-
插件版本不兼容:确保你使用的
path_provider
插件版本支持HarmonyOS。Flutter社区插件可能默认不支持HarmonyOS,需要查找是否有专为HarmonyOS适配的版本或分支。 -
配置问题:检查
pubspec.yaml
文件中是否已正确添加path_provider
依赖,并确保build.gradle
和其他配置文件已根据HarmonyOS的要求进行调整。 -
签名与权限:确保你的真机调试签名证书已正确配置,且App所需的权限(如读写存储权限)已在
config.json
中声明。 -
环境变量:检查Android Studio的Flutter和Dart插件是否更新到支持HarmonyOS的版本,同时确保鸿蒙SDK路径已正确设置在环境变量中。
-
日志分析:查看Android Studio的Logcat或Run窗口中的错误日志,分析具体的启动失败原因。
如果问题依旧没法解决请联系官网客服,官网地址是:https://www.itying.com/category-93-b0.html