美文网首页
Flutter学习_遇到的错误汇集(持续更新中)

Flutter学习_遇到的错误汇集(持续更新中)

作者: Sinda_Liu | 来源:发表于2019-11-25 11:11 被阅读0次

    1、操作:运行 flutter doctor 后
    报错:(Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses)
    解决办法: 运行flutter doctor --android-licenses, 一直输入 y 就可以

    2、操作:flutter create my_app_test
    报错:Cannot create a project within the Flutter SDK. Target directory
    '/Users/sinda_liu/flutter/my_app_test' is within the Flutter SDK at
    '/Users/sinda_liu/flutter’.
    解决办法:不要将工程项目目录建在flutter SDK目录里面

    3、操作:flutter run
    报错:More than one device connected; please specify a device with the '-d <deviceId>'
    flag, or use '-d all' to act on all devices.
    Sinda • 285bb649b1229c35bb72cef10b2cc • ios • iOS 13.1.2
    iPhone 11 Pro Max • 1E2110CA-5C63-4363-B353-B0DA1BD2 • ios •
    com.apple.CoreSimulator.SimRuntime.iOS-13-0 (simulator)
    解决办法:flutter run -d 1E2110CA-5C63-4363-B353-B0DA1BD2(选择运行目标对应的ID)

    -----20191218-------
    4、操作:加载本地的一张图片,icon: Image.asset('assets/home_scan')
    报错: flutter: Unable to load asset: assets/home_scan
    Image provider: AssetImage(bundle: null, name: "assets/home_scan")
    flutter: Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#244b8(), name: "assets/home_scan", scale:
    flutter: 1.0)
    解决办法:重点检查图片是否在pubspec.yaml里面添加路径,我这个是习惯了oc开发方式,忽略了后缀名。在assets/home_scan后加后缀名.png,改成assets/home_scan.png,再运行就可以了。

    相关文章

      网友评论

          本文标题:Flutter学习_遇到的错误汇集(持续更新中)

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