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

Module 'audio_service'未找到问题求助,附相关配置文件

求助:解决Module 'audio_service' not found错误

我碰到了Module 'audio_service' not found的报错,试过卸载重装Pod、新建iOS文件夹、通过xcworkspace启动项目这些办法,都没用。下面是我的相关配置文件,盼能得到解决思路。

pubspec.yaml 依赖配置

firebase_core: ^2.15.1
  firebase_auth: ^4.1.0
  flutter_launcher_icons: ^0.10.0
  lottie: ^1.4.2
  url_launcher: ^6.1.7
  animated_bottom_navigation_bar: ^1.1.0
  glassfy_flutter : ^1.3.1
  cloud_firestore: ^4.4.5
  flutter_native_splash: ^2.2.16
  page_transition: ^2.0.9
  audio_video_progress_bar: ^1.0.1
  rxdart: ^0.27.7
  rive: ^0.11.3
  google_mobile_ads: ^3.0.0
  firebase_messaging: ^14.6.7
  overlay_support: ^2.1.0
  onesignal_flutter: ^5.0.0
  awesome_dialog: ^3.1.0
  firebase_storage: ^11.6.0
  image_picker: ^1.0.6
  firebase_analytics: ^10.8.5
  just_audio_background: ^0.0.1-beta.11
  just_audio: ^0.9.36
  audio_service: ^0.18.12

Podfile 配置

# Uncomment this line to define a global platform for your project
platform :ios, '12.0'

target 'OneSignalNotificationServiceExtension' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  pod 'OneSignal'

  # Pods for OneSignalNotificationServiceExtension

end

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  #flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
  #target 'RunnerTests' do
   # inherit! :search_paths
  #end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

GeneratedPluginRegistrant 配置

#import "GeneratedPluginRegistrant.h"

#if __has_include(<audio_service/AudioServicePlugin.h>)
#import <audio_service/AudioServicePlugin.h>
#else
@import audio_service;
#endif

#if __has_include(<audio_session/AudioSessionPlugin.h>)
#import <audio_session/AudioSessionPlugin.h>
#else
@import audio_session;
#endif

内容的提问来源于stack exchange,提问作者AlefeRafael

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.30 00:12:46