Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Gradle cannot resolve com.facebook.android:facebook-android-sdk with a version range

ErrorFailed to resolve: com.facebook.android:facebook-android-sdk:[4,5)

Short answer

Gradle can only resolve the Facebook SDK from a repository that is declared in your build. The usual causes are a missing mavenCentral() entry, or a version range whose bounds match nothing you can download. Declare mavenCentral() in the repositories block, then use a fixed version, or latest.release as Facebook's own guide shows.

  • Applies to Gradle 8.x and 9.x, Android Gradle plugin 8.x and 9.x, Android Studio 2026
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Print the dependency declaration and the repositories next to each other. The SDK must be declared once, and at least one declared repository must host it.

    grep -rn "facebook-android-sdk" --include=*.gradle --include=*.kts .
    grep -rn -B2 -A6 "repositories" settings.gradle* build.gradle*
  2. 2Match what you see, then jump to its fix

    1. 1The error names the artifact and no repository has it; other Google libraries resolve finemavenCentral() is not in the repositories blockFix
    2. 2A range such as [4,5) is declared and no concrete version is printedThe version range excludes every version you can downloadFix

What does the error look like?

  • Failed to resolve: com.facebook.android:facebook-android-sdk:[4,5)
  • Failed to resolve: com.facebook.android:facebook-android-sdk

Cause 1 of 2

mavenCentral() is not in the repositories block

1Check

Facebook's setup guide tells you to add mavenCentral() to the repositories. Gradle only searches repositories that are declared, in the order they appear, so a project with only google() cannot find the SDK.

grep -rn "mavenCentral\|google()" settings.gradle* build.gradle*

2Fix

Add mavenCentral() to the repositories block, as Facebook's guide shows.

repositories {
    google()
    mavenCentral()
}

3Verify

Sync again; the dependency should show up under the module's runtime classpath.

./gradlew :app:dependencies --configuration releaseRuntimeClasspath | grep -i facebook

Confirmed by developers.facebook.com

Did this fix it?

Cause 2 of 2

The version range excludes every version you can download

1Check

In Gradle's range syntax a square bracket includes the bound and a round bracket excludes it, so [4,5) means 4 up to but not including 5. A range only works if a published version falls inside it in a repository you declared.

grep -rn "facebook-android-sdk" --include=*.gradle --include=*.kts .

2Fix

Replace the range with one fixed version from the SDK's release notes, or use the form Facebook's own guide shows. A fixed version also makes builds repeatable, which Android's build guide recommends over dynamic versions.

// Facebook's documented form
implementation("com.facebook.android:facebook-android-sdk:latest.release")
// or pin one release you have checked
// implementation("com.facebook.android:facebook-android-sdk:<version>")

3Verify

Run a sync and a debug build; Gradle should print one resolved version.

./gradlew :app:assembleDebug

Confirmed by docs.gradle.org

Did this fix it?

How do I stop it coming back?

  • Keep one clear place where repositories are declared, with mavenCentral() and google() in it.
  • Pin SDK versions instead of using ranges or plus signs.
  • Read the Facebook SDK release notes before raising the version, because newer majors change setup.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

Android Studio cannot pair the phone over Wi-Fi

The Pair devices over Wi-Fi dialog lists no device

Wireless pairing needs the phone on Android 11 or higher and on the same Wi-Fi network as the computer, with current Platform-Tools.

4 causes, each with a fix

Mobile apps

adb tcpip 5555 fails because no device is found

adb: more than one device/emulator

adb tcpip only works while the device is attached and listed by adb, because it tells the phone to start listening on port 5555.

4 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.