Flutter Bug总结(持续更新)

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
https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility

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.Flutter打包iOS上传App Store报错是因为framework 包含了x86_64, i386 架构,这个是苹果不允许的
App Store Connect Operation Error
Communication error. Please use diagnostic mode to check connectivity. You need to have outbound access to TCP port 443.

App Store Connect Operation Error
ERROR ITMS-90087: "Unsupported Architectures. The executable for Runner.app/Frameworks/Flutter.framework contains unsupported architectures '[x86_64]'."

App Store Connect Operation Error
ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'Runner.app/Frameworks/Flutter.framework/Flutter' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."

App Store Connect Operation Error
ERROR ITMS-90125: "The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple's linker."

App Store Connect Operation Warning
WARNING ITMS-90080: "The executable 'Payload/Runner.app/Frameworks/Flutter.framework' is not a Position Independent Executable. Please ensure that your build settings are configured to create PIE executables. For more information refer to Technical Q&A QA1788 - Building a Position Independent Executable in the iOS Developer Library."
WX20200702-131749.png
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

EXTRACTED_ARCHS=()

for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done

echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"

echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

done
Problem 11.如果Flutter检测到您的项目不支持Xcode 11.4及其以上,则可能会转到此。

https://flutter.dev/docs/development/ios-project-migration

Building for iOS, but the linked and embedded framework 'App.framework' was built for iOS Simulator.
Building for iOS Simulator, but the linked and embedded framework 'App.framework' was built for iOS.

根据文档提示进行就可以,在这里我要提醒注意两点,
1.删除App.framework 和Flutter.framework 不要彻底删除,删除引用即可
2.第五步,如果已经存在Flutter 或者 "Flutter" 不需要执行这一步

Problem 12. Flutter升级v2.0

<pre style="margin: 0px; tab-size: 4; white-space: pre-wrap;"> Undefined symbols for architecture x86_64:
"___gxx_personality_v0", referenced from:
+[FlutterSound registerWithRegistrar:] in flutter_sound_lite(FlutterSound.o)
+[FlutterSoundPlayerManager registerWithRegistrar:] in flutter_sound_lite(FlutterSoundPlayerManager.o)
-[FlutterSoundPlayerManager init] in flutter_sound_lite(FlutterSoundPlayerManager.o)
FlutterSoundPlayerReg(NSObject<FlutterPluginRegistrar>*) in flutter_sound_lite(FlutterSoundPlayerManager.o)
-[FlutterSoundPlayerManager handleMethodCall:result:] in flutter_sound_lite(FlutterSoundPlayerManager.o)
-[FlutterSoundPlayer startPlayerCompleted:duration:] in flutter_sound_lite(FlutterSoundPlayer.o)
-[FlutterSoundPlayer needSomeFood:] in flutter_sound_lite(FlutterSoundPlayer.o)
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete

</pre>

|

解决:因为里面有用到C++ 的一些东西。Xcode中Build Phases->link Binary with Libraries中添加libc++.tbd

Problem 13.Android复制手机号失败、点击电话失败**

机型:华为 P30 pro Harmony OS 2.0.0 吴艳军
解决:Android原生调用

|

<pre style="margin: 0px; tab-size: 4; white-space: pre-wrap;">/**

  • 打电话
    */
    public void linkTelephone(MethodCall call, MethodChannel.Result result) {
    String telephone = (String) call.arguments;
    Intent intent = new Intent(Intent.ACTION_DIAL);
    Uri data = Uri.parse("tel:" + telephone);
    intent.setData(data);
    startActivity(intent);
    result.success(true);
    }</pre>

|

Problem 14.Android拍照无反应**

机型:vivoi S6、vivo iQOO Z1、OPPO A93s(Color OS V11.1 Android 11)、一加8T
解决:Android原生调用

|

<pre style="margin: 0px; tab-size: 4; white-space: pre-wrap;">/**

  • 拍照功能
    */
    public void takePhoto(MethodCall call, MethodChannel.Result result) {
    Intent intent = new Intent();
    intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE);
    mPhoneUri = getPhotoName();
    intent.putExtra(MediaStore.EXTRA_OUTPUT, mPhoneUri);
    startActivityForResult(intent, CAMERA_PHOTO);
    currentResult = result;
    }</pre>

|

Problem 15 .Android点击导航,没有自动打开地图**

机型:努比亚nx659j
解决:适配Android11系统,配置相关地图包名

|

<pre style="margin: 0px; tab-size: 4; white-space: pre-wrap;">
<queries>

<package android:name="com.autonavi.minimap" />

<package android:name="com.baidu.BaiduMap" />

<package android:name="com.tencent.map" />
</queries></pre>

|

Problem 16.百度地图获取定位失败、超时**

解决:百度地图定位多次后失效,每次定位重新初始化定位对象。建议使用最新3.0空安全版本

12.Andorid百度地图搜索位置失效

解决:退出App时,杀死App进程。

|

<pre style="margin: 0px; tab-size: 4; white-space: pre-wrap;"> @Override
protected void onDestroy() {
super.onDestroy();
// 退出App
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(1);
}</pre>

|

Problem 18.Andorid百度地图搜索位置失效,错误信息如下。**

|

<pre style="margin: 0px; tab-size: 4; white-space: pre-wrap;">E/baidumapsdk(22666): Authentication Error
E/baidumapsdk(22666): =============================================
E/baidumapsdk(22666): ----------------- 鉴权错误信息 ------------
E/baidumapsdk(22666): sha1;package:9A:B9:A8:3F:79:BD:0F:F9:85:4C:06:45:46:7B:6B:3D:3F:78:F9:BF;com.huimin.crm
E/baidumapsdk(22666): key:gRhkr8VG2hdseXufqfPGuNyRMGGtkKcI
E/baidumapsdk(22666): errorcode: -11 uid: -1 appid -1 msg: httpsPost failed,IOException:java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
E/baidumapsdk(22666): 请仔细核查 SHA1、package与key申请信息是否对应,key是否删除,平台是否匹配
E/baidumapsdk(22666): errorcode为230时,请参考论坛链接:
E/baidumapsdk(22666): http://bbs.lbsyun.baidu.com/forum.php?mod=viewthread&tid=106461
E/baidumapsdk(22666): =============================================</pre>

|

原因:开代理,百度地图接口不允许抓包

解决:使用百度API关闭手机代理

15.iOS企业包安装无法验证App。

一:证书或者配置文件过期

解决方案:

打开苹果开发者后台,登录企业账号,检查证书与配置文件是否过期。

二:网络问题(无网络连接或网络信号弱)

解决方案:

1.检查设备是否有网络连接(打开浏览器,随便打开一个网页,能正常打开即网络正常)

2.查看app是否允许网络连接(设置->蜂窝网络->找到不app→WLAN与蜂窝网络)

3.切换网络运营商(比如:如果是电信4G无法验证app,那么使用移动的网或者联动的网再进行尝试)

4.移动位置

三:设备问题(确保不是越狱设备)

解决方案:使用非越狱设备安装app

四:系统问题(某些系统版本不稳定)

解决方案: 升级系统至最新版本(请确保系统是正式版本,而不是beta版本)

五.其他问题(优先)

解决方案:

(1)关闭网络;重启手机;重新开启网络。

(2 ) 关闭网络;打开设置->下滑找到Safari浏览器->点击进去,找到清除历史记录与网站数据->点击后等待一段时间,等文本重新变成蓝色就是清除好了;重新开启网络

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 158,847评论 4 362
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,208评论 1 292
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 108,587评论 0 243
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,942评论 0 205
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,332评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,587评论 1 218
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,853评论 2 312
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,568评论 0 198
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,273评论 1 242
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,542评论 2 246
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,033评论 1 260
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,373评论 2 253
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,031评论 3 236
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,073评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,830评论 0 195
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,628评论 2 274
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,537评论 2 269

推荐阅读更多精彩内容