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

Flutter集成audioplayers包出现构建失败问题求助

解决Flutter中audioplayers包构建失败问题

针对你安装audioplayers后出现的构建错误(找不到intellij-core-30.3.0.jar),可以尝试以下几种解决方案:

  • 升级audioplayers到最新稳定版:修改pubspec.yaml中的audioplayers依赖版本为当前最新稳定版(例如^4.0.1),执行flutter pub get后重新构建。新版本可能修复了依赖库的兼容问题。

  • 添加Maven中央仓库到Android配置:打开项目根目录下的android/build.gradle,在allprojects的repositories中添加mavenCentral():

    allprojects {
        repositories {
            google()
            mavenCentral()
            maven { url "https://jitpack.io" }
        }
    }
    

    保存后重新执行flutter build,让Gradle从Maven中央仓库尝试拉取缺失的包。

  • 强制替换intellij-core版本:如果特定版本的intellij-core无法获取,在android/app/build.gradle中添加强制依赖规则,替换为一个可正常获取的版本:

    configurations.all {
        resolutionStrategy {
            force 'com.android.tools.external.com-intellij:intellij-core:27.2.0'
        }
    }
    

    选择的版本需确保在Google Maven或Maven中央仓库存在。

  • 清除Gradle本地缓存:除了flutter clean,手动删除Gradle缓存目录:

    • Linux/macOS:执行rm -rf ~/.gradle/caches
    • Windows:删除C:\Users\你的用户名\.gradle\caches
      之后重新执行flutter pub get和flutter build。
  • 切换到Flutter稳定版:若当前使用的Flutter SDK版本存在兼容性问题,切换到稳定分支:

    flutter channel stable
    flutter upgrade
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.28 14:33:09