Where do I add repositories in my root-level build.gradle file?

Viewed 1081

Recently, I updated my Android Studio to Bumblebee(stable version) that was released around 2 weeks back. The structure of the build.gradle(root-level) file seems to have changed a lot since the last version.

I am facing issue in adding dependencies in the root-level build.gradle file.

Here is what I want to add.enter image description here

in the build.gradle file

enter image description here

4 Answers

settings.gradle instead of build.gradle:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
      // ...
        maven { url 'https://jitpack.io' }
    }
}

this way you dont need to use the build.gradle instead use the settings.gradle, these way it worked for me in Android Studio Bumblebee

  1. Keep your buildscript repositories at the top of your project-level build.gradle file:
buildscript {
    // ...
    repositories {
        // HERE
    }
}

plugins {
    // ...
}
  1. Move your allprojects repositories to settings.gradle file:
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        // HERE
    }
}
**1.instead of openping build.gradle just open the setting.gradle and just the stuff there..it will working properly**


pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()

        //..... just add here
        maven { url 'https://jitpack.io' }
    }
}
Related