HarmonyOS 鸿蒙Next demo里面替换了下lib代码,编译通过,运行起来停留在splash
HarmonyOS 鸿蒙Next demo里面替换了下lib代码,编译通过,运行起来停留在splash
demo里面替换了下lib代码,编译通过,运行起来停留在splash,报错
Thread:28418075056 [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method getApplicationDocumentsDirectory on channel plugins.flutter.io/path_provider)
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:313:7)
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E <asynchronous suspension>
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E #1 getApplicationDocumentsDirectory (package:path_provider/path_provider.dart:121:24)
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E <asynchronous suspension>
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E #2 debugLogFilePath (package:mhabit/utils/debug_info.dart:25:28)
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E <asynchronous suspension>
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E #3 _AppLoggerManager.init (package:mhabit/logging/logger_manager.dart:137:19)
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E <asynchronous suspension>
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E #4 main (package:mhabit/main.dart:26:3)
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E <asynchronous suspension>
Thread:28418075056 [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method getApplicationDocumentsDirectory on channel plugins.flutter.io/path_provider)
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:313:7)
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E <asynchronous suspension>
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E #1 getApplicationDocumentsDirectory (package:path_provider/path_provider.dart:121:24)
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E <asynchronous suspension>
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E #2 debugLogFilePath (package:mhabit/utils/debug_info.dart:25:28)
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E <asynchronous suspension>
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E #3 _AppLoggerManager.init (package:mhabit/logging/logger_manager.dart:137:19)
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E <asynchronous suspension>
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E #4 main (package:mhabit/main.dart:26:3)
05-20 18:00:24.588 47995-48029 A00000/XComFlutterEngine com.example.mhabit E <asynchronous suspension>
2 回复
这个插件有原生依赖,得用鸿蒙化的版本
https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/path_provider
配置方法:
https://gitee.com/openharmony-sig/flutter_packages/tree/master/packages/path_provider
配置方法:
dependencies:
path_provider:
git:
url: "https://gitee.com/openharmony-sig/flutter_packages.git"
path: "packages/path_provider/path_provider"
在HarmonyOS鸿蒙Next demo中替换lib代码后,若编译通过但运行停留在splash界面,这通常指示着运行时库或应用初始化阶段存在问题。可能的原因包括但不限于:
- 库兼容性问题:新替换的lib库可能与原系统中的其他库不兼容,导致启动失败。
- 初始化代码错误:替换的库中可能包含错误的初始化代码,阻止应用继续执行。
- 资源加载失败:应用可能依赖于某些在替换库中未正确加载的资源。
- 日志信息缺失:检查系统日志或应用日志,以获取更多关于为何停在splash界面的线索。
解决步骤可以尝试:
- 回滚更改:暂时恢复原先的lib库,验证应用是否能正常运行,以排除其他潜在问题。
- 逐步调试:使用调试工具逐步执行,观察在哪一步骤出现问题。
- 检查依赖:确保所有依赖项都正确链接,并且版本兼容。
- 清理重建:清理项目并重新编译,确保所有更改都已正确应用。
如果问题依旧没法解决请联系官网客服,官网地址是:https://www.itying.com/category-93-b0.html