美文网首页
学习 Flutter 遇到的一些问题

学习 Flutter 遇到的一些问题

作者: 四郎牧羊 | 来源:发表于2019-07-24 10:06 被阅读0次
Flutter

1.在进行版本升级时

爆出

Your flutter checkout has local changes that would be erased by upgrading. If you want to keep these changes, it is recommended that you stash them via "git stash" or else commit the changes to a local branch. If it is okay to remove local changes, then re-run this command with --force.

大致意思:您的flutter检测有局部变化,将升级回滚清除。如果要保留这些更改,建议您通过“git stash”存储它们,或者将更改提交到本地分支。如果可以的话要删除本地更改,请使用--force重新运行此命令。

初次安装Flutter时都是按照文档一步一步来的,不清楚这个局部变化 怎么来的。这次更新使用指令flutter upgrade --force

输入指令
Tools • Dart 2.3.0 (build 2.3.0-dev.0.1 cf4444b803)
Running "flutter packages upgrade" in flutter_app...                8.9s
Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.7.8+hotfix.3, on Microsoft Windows [Version 10.0.18362.239], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.4)
[√] Connected device (1 available)
• No issues found!

2.Flutter指令集

Common commands:
  flutter create <output directory> 
      //在指定目录中创建新的flutter项目。
    Create a new Flutter project in the specified directory.

  flutter run [options]
    //在连接的设备或模拟器上运行flutter应用程序。
    Run your Flutter application on an attached device or in an emulator.

Usage: flutter <command> [arguments]

Global options:
-h, --help                  Print this usage information.//打印此使用信息。
-v, --verbose               Noisy logging, including all shell commands executed.
                            If used with --help, shows hidden options.
                            //有噪声的日志记录,包括执行的所有shell命令。如果与--help一起使用
                            //,则显示隐藏选项。
                            
                            //目标设备ID或名称(允许前缀)。
-d, --device-id             Target device id or name (prefixes allowed).
    --version               Reports the version of this tool.//报告此工具的版本。
                            //此命令运行时禁止分析报告。
    --suppress-analytics    Suppress analytics reporting when this command runs.
                            //捕获一个bug报告文件提交给flutter团队。
                            //包含本地路径、设备标识符和日志片段。
    --bug-report            Captures a bug report file to submit to the Flutter team.
                            Contains local paths, device identifiers, and log snippets.

Available commands://可用命令:
  analyze                  Analyze the project's Dart code.//分析项目的DART代码。
  attach                   Attach to a running application.//附加到正在运行的应用程序。
                           //输出命令行shell完成安装脚本。
  bash-completion          Output command line shell completion setup scripts.
  build                    Flutter build commands.//Flutter 建立命令
  channel                  List or switch flutter channels.//列出或切换flutter通道。
                           //删除build/and.dart_工具/目录。
  clean                    Delete the build/ and .dart_tool/ directories.
  config                   Configure Flutter settings.//配置flutter设置。
  create                   Create a new Flutter project.
  devices                  List all connected devices.
                           //显示有关已安装工具的信息。
  doctor                   Show information about the installed tooling.
                           //为当前项目运行flutter驱动程序测试。
  drive                    Runs Flutter Driver tests for the current project.
  emulators                List, launch and create emulators.//列出、启动和创建模拟器。
  format                   Format one or more dart files.//格式化一个或多个DART文件。
  help                     Display help information for flutter.
  install                  Install a Flutter app on an attached device.
  logs                     Show log output for running Flutter apps.
                           //将主机应用程序从生成的目录移动到非生成的目录,以便开发人员编辑它们。
  make-host-app-editable   Moves host apps from generated directories to non-generated 
                           directories so that they can be edited by developers.
  packages                 Commands for managing Flutter packages.//用于管理flutter包的命令。
                           //填充flutter工具的二进制工件缓存。
  precache                 Populates the Flutter tool's cache of binary artifacts.
  run                      Run your Flutter app on an attached device.
  screenshot               Take a screenshot from a connected device.
  stop                     Stop your Flutter app on an attached device.
  test                     Run Flutter unit tests for the current project.
                          //开始和停止追踪跑步flutter应用程序。
  trace                    Start and stop tracing for a running Flutter app.
  upgrade                  Upgrade your copy of Flutter.
  version                  List or switch flutter versions.

3.编译时爆出 乱码 -xlint:unchecked 错误,

打开Android编辑新窗口,你会发先运行也是报错的


打开Android编译新窗口

原来在Flutter调用依赖包中 geolocator: ^4.0.3 对应的Android 依赖时使用的androidx,而app moudle中是使用的是support,所以冲突了。将app moudle 转成androidx。再次在Android编辑新窗口运行项目,无问题!

回到当前flutter项目,运行正常!!

4.在Android编辑窗口

运行时爆出

WARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'.

因为gradle版本导致的问题,近似无解,可以忽略 :https://stackoverflow.com/questions/54198955/android-studio3-3-variantoutput-getprocessresources-is-obsolete-and-has-been-r

相关文章

网友评论

      本文标题:学习 Flutter 遇到的一些问题

      本文链接:https://www.haomeiwen.com/subject/bkptrctx.html