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

安装audio_waveforms包后出现Failed to transform exoplayer-hls-2.17.1.aar错误

解决Flutter中audio_waveforms包依赖exoplayer-hls构建失败的问题

问题核心

添加audio_waveforms包后构建失败,原因是Gradle无法找到com.google.android.exoplayer:exoplayer-hls:2.17.1的aar文件,该版本可能已从maven仓库中移除或未正确同步。

解决方案

  • 检查Gradle仓库配置
    打开项目根目录下的android/build.gradle,确保仓库配置包含google()和mavenCentral(),且google()优先级高于其他仓库:

    allprojects {
        repositories {
            google()
            mavenCentral()
            // 若保留jcenter()请放在最后
        }
    }
    

    旧项目可能仅配置了jcenter,但exoplayer的新版本仅在google和mavenCentral仓库发布。

  • 强制替换exoplayer版本
    在android/build.gradle中添加强制依赖策略,替换为仓库中存在的稳定版本(如2.19.1):

    subprojects {
        project.configurations.all {
            resolutionStrategy {
                force 'com.google.android.exoplayer:exoplayer-hls:2.19.1'
            }
        }
    }
    

    选择版本时优先考虑与当前Flutter版本兼容的稳定分支。

  • 清理缓存并重建
    执行以下命令彻底清理缓存后重新构建:

    flutter clean
    rm -rf android/.gradle
    flutter pub get
    flutter run
    
  • 替换为官方最新版audio_waveforms
    检查pubspec.yaml,若使用的是第三方修改的audio_waveforms_fix包,替换为官方最新版:

    dependencies:
      audio_waveforms: ^1.0.0 # 替换为pub.dev上的最新版本号
    

    官方包通常已修复依赖适配问题,避免使用非官方的fix分支。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.13 19:38:22