Fixing “No Repositories Defined” Error in Flutter Android Build (Gradle + Firebase Google Services)

Fix “App must target Android 15 (API 35)” on Google Play (Flutter & Native) – Step-by-Step

Fix Google Play’s “Target Android 15 (API 35)” Requirement

Updated: · Works for Flutter & Native Android · Play Console Policy

If your app currently targets Android 14 (API 34), follow this guide to update to API 35 and resolve common Gradle errors.

gradle error
Table of Contents
  1. What changed on Google Play?
  2. Symptoms & error messages
  3. Quick fix checklist
  4. App-level build.gradle (Flutter/Native)
  5. Project-level build.gradle & repositories
  6. Gradle Wrapper & Android Gradle Plugin
  7. Flutter commands & verification
  8. Play Console release checklist
  9. FAQ & troubleshooting

1) What changed on Google Play?

From August 31, 2025, apps must target an API level within 1 year of the latest Android release. Practically, this means you need to target Android 15 (API 35) or higher to keep publishing updates.

Warning you may see: “App must target Android 15 (API level 35) or higher. You won’t be able to release app updates after Aug 31, 2025.”

2) Symptoms & error messages

When you try to build or run, you may see:

  • Your app currently has compileSdk = 34 and targetSdk = 34.
  • Gradle failure: Cannot resolve external dependency com.google.gms:google-services:4.4.2 because no repositories are defined.
Root cause: The project is still set to API 34 and the buildscript.repositories block (with google()/mavenCentral()) is missing, so Gradle can’t download classpath plugins.

3) Quick fix checklist

  • Bump compileSdk and targetSdk to 35.
  • Ensure Gradle Wrapper8.10 and AGP (Android Gradle Plugin) ≥ 8.6.0.
  • Add google() and mavenCentral() inside both buildscript.repositories and top-level allprojects.repositories.
  • Update desugaring libs to the latest stable (com.android.tools:desugar_jdk_libs).
  • Clean, rebuild, and test on an Android 15 emulator/device.
  • Upload AAB to internal testing, then promote to production.

4) App-level build.gradle (module: app)

Before (non-compliant)

android {
    namespace = "com.pradeepthedeveloper.in"
    compileSdk = 34
    ...
    defaultConfig {
        targetSdk = 34
        ...
    }
}
dependencies {
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.google.android.gms:play-services-auth:20.5.0'
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2'
}

After (compliant with API 35)

plugins {
    id "com.android.application"
    id "com.google.gms.google-services"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}

android {
    namespace = "com.pradeepthedeveloper.in"
compileSdk = 35 ndkVersion = "25.1.8937393" compileOptions { coreLibraryDesugaringEnabled true sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = "1.8" } defaultConfig { applicationId = "com.pradeepthedeveloper.in"
minSdk = 26 targetSdk = 35 versionCode = flutter.versionCode versionName = flutter.versionName multiDexEnabled true } signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile file(keystoreProperties['storeFile']) storePassword keystoreProperties['storePassword'] } debug { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile file(keystoreProperties['storeFile']) storePassword keystoreProperties['storePassword'] } } buildTypes { release { signingConfig signingConfigs.release minifyEnabled true shrinkResources true } } } dependencies { implementation 'androidx.multidex:multidex:2.0.1' implementation 'com.google.android.gms:play-services-auth:20.5.0' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4' } flutter { source = "../.." }
Tip: If you use any libraries with Android 14/15 behavior changes (notifications, background tasks, exact alarms, storage), test those flows thoroughly after the bump.

5) Project-level build.gradle & repositories (fixes “no repositories are defined”)

That error happens when classpath plugins (e.g., com.google.gms:google-services) can’t be fetched because the buildscript.repositories block is missing.

Correct project-level build.gradle

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:8.6.0"
        classpath "com.google.gms:google-services:4.4.2"
        // Add Crashlytics/Perf if used:
        // classpath "com.google.firebase:firebase-crashlytics-gradle:3.0.2"
        // classpath "com.google.firebase:perf-plugin:1.4.2"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = "../build"

subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}

subprojects {
    project.evaluationDependsOn(":app")
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}
If you only put google() and mavenCentral() under allprojects but not under buildscript, Gradle still fails for classpath dependencies. Make sure both are present.

6) Gradle Wrapper & Android Gradle Plugin versions

gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip

Android Gradle Plugin (AGP)

classpath "com.android.tools.build:gradle:8.6.0"

AGP and Gradle must be compatible. The above combo works well for compile/targetSdk 35 in 2025.

Flutter note: Newer Flutter projects use the plugins DSL and settings.gradle for plugin management. Keeping the classpath and repositories in the project build.gradle as shown remains compatible and fixes resolution errors.

7) Flutter commands & local verification

  1. Sync dependencies:
    flutter clean
    flutter pub get
  2. Build locally:
    flutter build appbundle   # AAB for Play Store
    # or
    flutter build apk         # For quick device testing
  3. Run on Android 15 device/emulator:
    flutter run -d emulator-5554  # example device id
Test carefully: Notifications permission prompts, foreground services, alarms, and any background work may behave differently on Android 15.

8) Play Console release checklist

  • Target/compile SDK set to 35; project builds an .aab.
  • Upload to Internal testing first; install and verify on Android 15.
  • Resolve policy warnings (privacy, data safety, sensitive permissions).
  • Promote to Production when stable.
  • Confirm the Play Console inbox message that your app is now compliant.

Open Releases overview

9) FAQ & Troubleshooting

Q1) I see “Cannot resolve external dependency ... because no repositories are defined.”

Add google() and mavenCentral() inside both buildscript.repositories and allprojects.repositories in the project-level build.gradle (see section 5).

Q2) Build fails after bumping to API 35.

  • Update Gradle to 8.10 and AGP to 8.6.0.
  • Update desugaring libs to 2.0.4.
  • Clean and rebuild. Check library release notes for Android 15 compatibility.

Q3) Do I have to change minSdk?

No. The Play requirement is about targetSdk. You can keep your current minSdk (26 in this example).

Q4) Does this affect existing installs?

Your current store listing remains live. You just won’t be able to publish updates after the deadline if you don’t target API 35 or higher.

Q5) Flutter-specific gotchas?

  • Some plugins may need newer versions to support API 35.
  • If you use background services/alarms, verify behavior on Android 15.

Copy-paste recap

  1. App-level build.gradle: set compileSdk = 35, targetSdk = 35, update desugaring lib.
  2. Project-level build.gradle: add buildscript.repositories { google(); mavenCentral() } and classpath deps; keep allprojects.repositories too.
  3. Gradle/AGP: Wrapper 8.10, AGP 8.6.0.
  4. Build & test: flutter cleanflutter pub getflutter build appbundle → test on Android 15.
  5. Publish: Internal testing → Production in Play Console.

© 2025 pradeepthedeveloper.in · This guide was prepared for upgrading an app from API 34 → 35 and resolving repository configuration errors during the Gradle sync/build.

Post a Comment

Previous Post Next Post