Flutter Bug总结(持续更新)

2,299 阅读4分钟

image.png

######Problem 1.上传App Store构建版本,上传成功,App Store Connect并不显示构建版本?

权限未配置齐全 升到iOS10之后,需要设置权限的有: 麦克风权限:Privacy - Microphone Usage Description 是否允许此App使用你的麦克风? 相机权限: Privacy - Camera Usage Description 是否允许此App使用你的相机? 相册权限: Privacy - Photo Library Usage Description 是否允许此App访问你的媒体资料库? 通讯录权限: Privacy - Contacts Usage Description 是否允许此App访问你的通讯录? 蓝牙权限:Privacy - Bluetooth Peripheral Usage Description 是否许允此App使用蓝牙? 语音转文字权限:Privacy - Speech Recognition Usage Description 是否允许此App使用语音识别? 日历权限:Privacy - Calendars Usage Description 定位权限:Privacy - Location When In Use Usage Description 定位权限: Privacy - Location Always Usage Description 位置权限:Privacy - Location Usage Description 媒体库权限:Privacy - Media Library Usage Description 健康分享权限:Privacy - Health Share Usage Description 健康更新权限:Privacy - Health Update Usage Description 运动使用权限:Privacy - Motion Usage Description 音乐权限:Privacy - Music Usage Description 提醒使用权限:Privacy - Reminders Usage Description Siri使用权限:Privacy - Siri Usage Description 电视供应商使用权限:Privacy - TV Provider Usage Description 视频用户账号使用权限:Privacy - Video Subscriber Account Usage Description

######Problem 2.上传App Store构建版本,上传成功,App Store Connect显示正在处理中,过一会版消失?

工程中引用权限插件有问题 预估为私有api访问 去除插件上传成功 权限处理插件 permission_handler: 2.1.2 提交应用到iTunes Connect时构建版本“正在处理”后直接消失——此构建版本无效

######Problem 3.Flutter不在代码中设置不能抓包? Flutter中http请求抓包解决方案

######Problem 4.Error: Expected an identifier, but got ''. const flutter clean

######Problem 5.Flutter杂症( flutter packages pub run build_runner build ) --delete-conflicting-outputs //清除之前生成的文件,如果直接运行下面的不行。可以先尝试运行这个 flutter packages pub run build_runner clean //可以直接运行这个 flutter packages pub run build_runner build --delete-conflicting-outputs Flutter杂症( flutter packages pub run build_runner build )

######Problem 6.Flutter SocketException: Failed to create server socket (OS Error: Permission denied, errno = 13), address = 127.0.0.1, port = 0

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Built build\app\outputs\apk\debug\app-debug.apk.
I/flutter ( 7011): Observatory server failed to start after 1 tries
I/flutter ( 7011): Observatory server failed to start after 2 tries
I/flutter ( 7011): Observatory server failed to start after 3 tries
I/flutter ( 7011): Observatory server failed to start after 4 tries
I/flutter ( 7011): Observatory server failed to start after 5 tries
I/flutter ( 7011): Observatory server failed to start after 6 tries
I/flutter ( 7011): Observatory server failed to start after 7 tries
I/flutter ( 7011): Observatory server failed to start after 8 tries
I/flutter ( 7011): Observatory server failed to start after 9 tries
I/flutter ( 7011): Observatory server failed to start after 10 tries
I/flutter ( 7011): Observatory server failed to start after 11 tries
I/flutter ( 7011): Could not start Observatory HTTP server:
I/flutter ( 7011): SocketException: Failed to create server socket (OS Error: Permission denied, errno = 13), address = 127.0.0.1, port = 0
I/flutter ( 7011): #0      _NativeSocket.bind (dart:io/runtime/bin/socket_patch.dart:591:7)
I/flutter ( 7011): <asynchronous suspension>
I/flutter ( 7011): #1      _RawServerSocket.bind (dart:io/runtime/bin/socket_patch.dart:1206:26)
I/flutter ( 7011): #2      _ServerSocket.bind (dart:io/runtime/bin/socket_patch.dart:1466:29)
I/flutter ( 7011): #3      ServerSocket.bind (dart:io/runtime/bin/socket_patch.dart:1457:26)
I/flutter ( 7011): #4      _HttpServer.bind (dart:_http/http_impl.dart:2520:25)
I/flutter ( 7011): #5      HttpServer.bind (dart:_http/http.dart:227:19)
I/flutter ( 7011): #6      Server.startup.poll (dart:vmservice_io/server.dart:355:36)
I/flutter ( 7011): <asynchronous suspension>
I/flutter ( 7011): #7      Server.startup (dart:vmservice_io/server.dart:367:23)
I/flutter ( 7011): <asynchronous suspension>
I/flutter ( 7011): #8      main (dart:vmservice_io/vmservice_io.dart:253:12)
I/flutter ( 7011): 
在android工程AndroidManifest.xml配置
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

image.png

######Problem 6.Flutter在安卓部分真机上不显示图标(显示为flutter icon) 安卓系统图标缓存问题 切换主题即可 (究极大法:出厂重置)

######Problem 7.Flutter项目中在代码端判断当前运行模式并取不同的url地址

static String initHost() {

    const String inProduction = const String.fromEnvironment("dart.vm.product");

    if (inProduction == "true") {
      // 线上地址
    } else if (inProduction == "false") {
      // 线下地址
    } else {
      // 测试地址
    }
  }

######Problem 8.如何将Flutter应用程序迁移到AndroidX Flutter应用程序迁移到AndroidX flutter.dev/docs/develo…

######Problem 9.

    Building App.framework for arm64...
    Building AOT snapshot in release mode (ios-release)...             33.2s
    Built to build/aot/.
    Snapshotting (IOSArch.armv7) exited with non-zero exit code: 1
    Snapshotting (IOSArch.arm64) exited with non-zero exit code: 0
    cp: build/aot/App.framework: No such file or directory
    error: cannot parse the debug map for 'build/aot/App.framework/App': No such file or directory
    Failed to generate debug symbols (dSYM) file for build/aot/App.framework/App.

在之前版本构建flutter是成功的,但是我在升级Xcode11-beta macOS10.15时构建发生过以上错误

解决:Xcode-Architectures-Valid Architectures- armv7

######Problem 10.

Launching lib\main.dart on FRD AL10 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "E:\studyDemo\FlutterDome\flutter_app\android\gradlew.bat" exited abnormally:
Starting a Gradle Daemon (subsequent builds will be faster)
 
 
FAILURE: Build failed with an exception.
 
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not download kotlin-compiler-embeddable.jar (org.jetbrains.kotlin:kotlin-compiler-embeddable:1.2.71)
      > Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.2.71/kotlin-compiler-embeddable-1.2.71.jar'.
         > Read timed out
   > Could not download fastutil.jar (it.unimi.dsi:fastutil:7.2.0)
      > Could not get resource 'https://jcenter.bintray.com/it/unimi/dsi/fastutil/7.2.0/fastutil-7.2.0.jar'.
         > Read timed out
 
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
 
* Get more help at https://help.gradle.org
 
BUILD FAILED in 5m 32s
  Command: E:\studyDemo\FlutterDome\flutter_app\android\gradlew.bat app:properties
 
Finished with error: Please review your Gradle project setup in the android/ folder.

blog.csdn.net/mo911108/ar…