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

使用GluonFX开发Android应用时无法引入Firebase Messaging Maven依赖

解决GluonFX集成Firebase推送时依赖找不到的问题

问题根源

你遇到的Could not find artifact com.google.firebase:firebase-messaging:jar:24.0.0错误,本质是Firebase针对Android的依赖包是AAR格式,而非标准JAR格式,Maven默认会查找JAR包,因此匹配失败。

解决方案

1. 显式指定依赖类型为AAR

修改pom.xml中的Firebase依赖,添加<type>aar</type>和<scope>runtime</scope>:

<dependency>
    <groupId>com.google.firebase</groupId>
    <artifactId>firebase-messaging</artifactId>
    <version>24.0.0</version>
    <type>aar</type>
    <scope>runtime</scope>
</dependency>
  • type=aar告诉Maven去查找AAR格式的包
  • scope=runtime是因为GluonFX构建Android应用时,原生依赖会在打包阶段处理,不需要编译时依赖

2. 替换Google仓库地址(可选)

如果原google仓库访问有问题,替换为等效的官方镜像地址:

<repository>
    <id>google</id>
    <url>https://dl.google.com/dl/android/maven2/</url>
</repository>

3. 尝试移除手动添加的Firebase依赖(推荐)

Gluon Attach的push-notifications组件已经内置了Firebase推送所需的原生依赖,你可以尝试直接移除手动添加的firebase-messaging依赖,仅保留:

<dependency>
    <groupId>com.gluonhq.attach</groupId>
    <artifactId>push-notifications</artifactId>
    <version>4.0.21</version>
</dependency>

GluonFX会在构建Android应用时自动引入对应的Firebase原生库,避免手动依赖的版本冲突或格式问题。

验证步骤

执行以下命令强制更新依赖缓存并构建:

mvn clean install -U

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.20 10:54:54