基于this flutter 文档:
这一行flutter create --template=package hello
应产生以下内容:
- 许可证
- 测试/hello_test.dart
- hello.iml
- .gitignore
- .元数据
- pubspec.yaml
- 工具。
- README.md
- lib/hello.dart
- .idea/modules.xml、.idea/workspace.xml
- CHANGELOG.md
但是当更新到flutter 3.7时 它会生成更多内容,如下图所示:
它创建了更多内容,例如:
- 安卓
- ios
- 等等
并给出一些警告:
This app is using a deprecated version of the Android embedding. To avoid unexpected runtime failures, or future build failures, try to migrate this app to the V2 embedding.
完整日志:
PS E:\***\***\****> flutter create --template=package hello
Creating project hello...
Running "flutter pub get" in hello...
Resolving dependencies in hello... (1.8s)
+ async 2.10.0
+ boolean_selector 2.1.1
+ characters 1.2.1
+ clock 1.1.1
+ collection 1.17.0 (1.17.1 available)
+ fake_async 1.3.1
+ flutter 0.0.0 from sdk flutter
+ flutter_lints 2.0.1
+ flutter_test 0.0.0 from sdk flutter
+ js 0.6.5 (0.6.7 available)
+ lints 2.0.1
+ matcher 0.12.13 (0.12.14 available)
+ material_color_utilities 0.2.0
+ meta 1.8.0 (1.9.0 available)
+ path 1.8.2 (1.8.3 available)
+ sky_engine 0.0.99 from sdk flutter
+ source_span 1.9.1
+ stack_trace 1.11.0
+ stream_channel 2.1.1
+ string_scanner 1.2.0
+ term_glyph 1.2.1
+ test_api 0.4.16 (0.4.18 available)
+ vector_math 2.1.4
Changed 23 dependencies in hello!
This app is using a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to migrate this app to the V2 embedding.
Take a look at the docs for migrating an app:
https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects
Wrote 13 files.
All done!
Your package code is in hello\lib\hello.dart
我根据该警告在线搜索,没有一个解决方案提到包。我的问题是为什么它与以前不同以及我应该如何处理该警告。我需要帮助和你的指导,提前谢谢你。
最佳答案
似乎警告是错误生成的,因为包中没有 AndroidManifest.xml
。
关于另一个问题(包内的平台目录),我发现它仍然处于打开状态:https://github.com/flutter/flutter/issues/119844
所以,目前没有解决方案。
这里讨论的是临时解决方案(并不适合所有情况):https://github.com/flutter/flutter/issues/119844#issuecomment-1414478314
关于Flutter 3.7 基于此命令 `flutter create --template=package <package_name>` 创建与之前(3.3)和文档不同的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75343616/