flutter webrtc 编译报错 Could not build the precompiled application for the device.

本文记录了一次使用FlutterWebRTC插件开发过程中遇到的编译错误,并提供了详细的错误信息及解决步骤。通过修改rtc_data_channel_impl.dart文件中RTCDataChannelNative类的方法实现,最终解决了问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

flutter webrtc运行报错

Running Xcode build...
Xcode build done.                                           19.7s
Failed to build iOS app
Error output from Xcode build:
↳
    2022-03-31 15:36:50.750 xcodebuild[10731:312247] Requested but did not find extension point with
    identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension
    Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
    2022-03-31 15:36:50.751 xcodebuild[10731:312247] Requested but did not find extension point with
    identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension
    Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in
    com.apple.dt.IDEWatchSupportCore
    ** BUILD FAILED **


Xcode's output:
↳
    Writing result bundle at path:
    	/var/folders/55/9mlqm5pn4r570ldrcxqb0mx80000gn/T/flutter_tools.KcBTKD/flutter_ios_build_temp_dir
    	ICE83K/temporary_xcresult_bundle

    /usr/local/Caskroom/flutter/2.10.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.8.
    4/lib/src/native/rtc_data_channel_impl.dart:16:7: Error: The non-abstract class
    'RTCDataChannelNative' is missing implementations for these members:
     - RTCDataChannel.bufferedAmount
     - RTCDataChannel.id
    Try to either
     - provide an implementation,
     - inherit an implementation from a superclass or mixin,
     - mark the class as abstract, or
     - provide a 'noSuchMethod' implementation.

    class RTCDataChannelNative extends RTCDataChannel {
          ^^^^^^^^^^^^^^^^^^^^
    /usr/local/Caskroom/flutter/2.10.3/flutter/.pub-cache/hosted/pub.dartlang.org/webrtc_interface-1.
    0.3/lib/src/rtc_data_channel.dart:79:11: Context: 'RTCDataChannel.bufferedAmount' is defined
    here.
      int get bufferedAmount;
              ^^^^^^^^^^^^^^
    /usr/local/Caskroom/flutter/2.10.3/flutter/.pub-cache/hosted/pub.dartlang.org/webrtc_interface-1.
    0.3/lib/src/rtc_data_channel.dart:74:11: Context: 'RTCDataChannel.id' is defined here.
      int? get id;
              ^^
    /usr/local/Caskroom/flutter/2.10.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.8.
    4/lib/src/native/rtc_data_channel_impl.dart:36:15: Error: The return type of the method
    'RTCDataChannelNative.label' is 'String?', which does not match the return type, 'String', of the
    overridden method, 'RTCDataChannel.label'.
    Change to a subtype of 'String'.
      String? get label => _label;
                  ^
    /usr/local/Caskroom/flutter/2.10.3/flutter/.pub-cache/hosted/pub.dartlang.org/webrtc_interface-1.
    0.3/lib/src/rtc_data_channel.dart:77:14: Context: This is the overridden method ('label').
      String? get label;
                 ^
    Failed to package /Users/***/Desktop/CQTOWTSDK_iOS/FlutterSDK/flutter-webrtc-demo.
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
    /Users/***/Desktop/CQTOWTSDK_iOS/FlutterSDK/flutter-webrtc-demo/ios/Pods/Pods.xcodeproj
    : warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 4.3, but the range of
    supported deployment target versions is 9.0 to 15.4.99. (in target 'Libyuv' from project 'Pods')

    Result bundle written to path:
    	/var/folders/55/9mlqm5pn4r570ldrcxqb0mx80000gn/T/flutter_tools.KcBTKD/flutter_ios_build_temp_dir
    	ICE83K/temporary_xcresult_bundle


Could not build the precompiled application for the device.

Error launching application on Ming.

尝试了 清除缓存 重装 cocoapods , 重装flutter都不行最后
解决方案:找到flutter加载缓存加载的

  /usr/local/Caskroom/flutter/2.10.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.8.
    4/lib/src/native/rtc_data_channel_impl.dart

文件 将
这几个的 get 给去掉
在这里插入图片描述

保存后再次 flutter run 就行了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值