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

Flutter引入background_fetch插件后遇com.transistorsoft依赖找不到问题求助

解决background_fetch依赖找不到的问题

这个错误是因为background_fetch: ^1.1.6依赖的com.transistorsoft:tsbackgroundfetch库不在默认的Maven仓库中,加上旧版本的配置未适配当前仓库规则,按以下步骤解决:

  • 升级background_fetch到最新稳定版
    1.1.6是较旧的版本,建议直接在pubspec.yaml里把版本号替换为pub.dev上的最新稳定版(比如background_fetch: ^2.8.1),然后执行flutter pub get。新版本已适配仓库配置,大概率能直接解决依赖问题。

  • 手动添加TransistorSoft的Maven仓库(若坚持使用旧版本)
    如果不想升级,需要在项目的android/build.gradle文件中,找到allprojects下的repositories块,添加TransistorSoft的私有仓库:

    allprojects {
        repositories {
            // 保留原有仓库配置
            maven { url "https://transistorsoft.jfrog.io/artifactory/maven/" }
        }
    }
    
  • 清理缓存并重新构建
    完成上述操作后,执行以下命令确保缓存清理干净并重新构建项目:

    flutter clean
    flutter pub get
    flutter run
    

额外提醒:Android 12及以上系统对后台任务有严格限制,即使依赖问题解决,应用终止后每15分钟执行任务的需求,还需适配系统后台规则(比如申请电池优化豁免、使用符合系统规范的调度API)。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.21 07:37:06