Flutter問題匯總

1、Building flutter tool...問題

2、flutter pub get卡死

網(wǎng)絡(luò)問題導(dǎo)致:

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

圖片數(shù)據(jù)無效,檢查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 對網(wǎng)絡(luò)請求做了一些限制,不能直接訪問 Http 域名的地址

  • android解決
<application
        android:icon="@mipmap/ic_launcher"
        android:usesCleartextTraffic="true"http://加這一行
        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
  • IOS解決
<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
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容