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

后端模块Firebase Admin触发版本兼容错误的技术求助

Fixing "All firebase libraries must be either above or below 14.0.0" Error in Backend Module

Hey there, let's work through this Firebase Admin version mismatch issue you're hitting in your backend module. This error pops up when there's a mix of Firebase library versions spanning the 14.0.0 boundary—some older, some newer. Here's how to resolve it step by step:

1. Standardize All Firebase Admin Dependency Versions

First, make sure every Firebase-related dependency in your backend module uses the same version, either all below 14.0.0 or all above/equal to it.

  • Open your backend module's build.gradle file and look for lines like implementation 'com.google.firebase:firebase-admin:x.x.x'.
  • If you have multiple Firebase dependencies (e.g., firebase-auth, firebase-database alongside firebase-admin), ensure they all share the exact same version number. For example, pick a stable version like 8.1.0 (below 14.0.0) or a newer compatible version like 9.2.0.

2. Update Endpoints Framework Plugin for Compatibility

The older endpoints-framework-gradle-plugin:1.0.3 might have compatibility issues with newer Firebase Admin versions. Try updating the plugin to a more recent stable release:

  • In your backend's buildscript block, replace the plugin version:
    classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:2.2.0'
    
  • Also, update the App Engine Gradle plugin to a matching version (e.g., 2.4.0) to avoid further conflicts:
    classpath 'com.google.cloud.tools:appengine-gradle-plugin:2.4.0'
    
  • Don't forget to add mavenCentral() to your buildscript repositories—newer plugins are hosted there instead of JCenter.

3. Force Dependency Resolution to Avoid Indirect Conflicts

Sometimes, third-party dependencies or the Endpoints plugin might pull in older/newer Firebase libraries indirectly. To fix this, force all Firebase dependencies to use your chosen version:

Add this block to your backend's build.gradle file:

configurations.all {
    resolutionStrategy.force 'com.google.firebase:firebase-admin:8.1.0'
    // Add other Firebase dependencies here if you use them, e.g.:
    // resolutionStrategy.force 'com.google.firebase:firebase-auth:8.1.0'
}

4. Clean and Rebuild to Clear Cache

Old build cache can sometimes hold onto conflicting versions. Run these steps to ensure a fresh build:

  • Execute ./gradlew clean (Windows: gradlew clean) in your project root.
  • Sync your Gradle files in Android Studio.
  • Rebuild the entire project.

Example Backend build.gradle Snippet

Here's how your updated backend config might look:

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:2.2.0'
        classpath 'com.google.cloud.tools:appengine-gradle-plugin:2.4.0'
    }
}

apply plugin: 'java'
apply plugin: 'com.google.cloud.tools.endpoints-framework-server'
apply plugin: 'com.google.cloud.tools.appengine'

repositories {
    jcenter()
    mavenCentral()
}

dependencies {
    implementation 'com.google.firebase:firebase-admin:8.1.0'
    // Add your other backend dependencies here
}

configurations.all {
    resolutionStrategy.force 'com.google.firebase:firebase-admin:8.1.0'
}

If you still run into issues, use the ./gradlew backend:dependencies command to generate a full dependency tree—this will help you spot any hidden conflicting Firebase versions being pulled in by other libraries.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.27 03:37:00