Flutter问题汇总

2020-11-01  本文已影响0人  youseewhat

1、Building flutter tool...问题

2、flutter pub get卡死

网络问题导致:

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

3、Waiting for another flutter command to release the startup lock...

等待另一个flutter命令释放启动锁,如果想终止上一个命令锁:

sudo kill $(ps aux | grep flutter | grep -v grep  | awk '{print $2}')

4、Finished with error: Failed to establish connection with the application instance in Chrome.

This can happen if the websocket connection used by the web tooling is unable to correctly establish a connection, for example due to a firewall.

解决:127.0.0.1 localhost

image.png

5、Exception: Invalid image data

图片数据无效,检查url是否是有效的jpg下载地址

Image.network(
              imgList[index]["url"],
              fit: BoxFit.fill,
            );

6、Bad state: Insecure HTTP is not allowed by platform:http://

IOS 和 Android 9.0 对网络请求做了一些限制,不能直接访问 Http 域名的地址

<application
        android:icon="@mipmap/ic_launcher"
        android:usesCleartextTraffic="true"//加这一行
        android:networkSecurityConfig="@xml/network_security"
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
   <base-config cleartextTrafficPermitted="true">
       <trust-anchors>
           <certificates src="system" />
       </trust-anchors>
   </base-config>
</network-security-config>

network_secturity
<key>NSAppTransportSecurity</key>
        <dict>
            <key>NSAllowsArbitraryLoads</key>
            <true/>
        </dict>
info.plist

7、Automatically assigning platform iOS with version 9.0 on target Runner

ios/Podfile文件增加平台配置

 platform :ios, '9.0'
image.png
上一篇下一篇

猜你喜欢

热点阅读