You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级targetSdkVersion至34后Flutter应用崩溃问题求助

Flutter targetSdkVersion 34升级后崩溃问题解决方案

1. INSTALL_FAILED_UPDATE_INCOMPATIBLE(签名不匹配)

  • 确认构建签名配置一致性:检查android/app/build.gradle中signingConfigs节点的keystore路径、别名、密码是否与旧版本完全一致,避免debug和release签名混用。
  • 卸载旧版本后重装:直接移除设备上已安装的com.olenergies.olenpepsmobile应用,再安装新版本。
  • 清理构建缓存:执行flutter clean命令,删除android/.gradle、android/app/build目录后重新构建项目。

2. geolocator_service_updates_android通道PlatformException(需指定RECEIVER_EXPORTED/NOT_EXPORTED)

  • 升级geolocator插件:Android 14要求静态注册的广播接收器必须显式声明android:exported属性,将pubspec.yaml中geolocator依赖更新至最新稳定版,执行flutter pub get生效。
  • 手动适配(无法升级插件时):在android/app/src/main/AndroidManifest.xml中找到geolocator相关广播接收器,添加android:exported属性,示例:
    <receiver
        android:name="com.baseflow.geolocator.location.LocationBroadcastReceiver"
        android:exported="false">
        <intent-filter>
            <action android:name="flutter.baseflow.geolocator.location_updates"/>
        </intent-filter>
    </receiver>
    

3. 蓝牙扫描UUID过大致命异常

  • 校验UUID合法性:检查扫描逻辑中传入的UUID列表,移除过长、格式错误或冗余的UUID,Android 14对蓝牙扫描参数的校验更严格。
  • 升级蓝牙插件:若使用flutter_blue_plus等第三方蓝牙插件,更新至支持targetSdkVersion 34的最新版本,插件通常已修复此类兼容性问题。
  • 确认权限配置:确保AndroidManifest.xml中正确声明BLUETOOTH_SCAN权限,并在代码中动态申请POST_NOTIFICATIONS(部分蓝牙扫描场景需此权限)。

内容的提问来源于stack exchange,提问作者Stéphane de Luca

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 17:44:59