Android Studio New Update build.gradle not generate all project section Error Solution

Published: 09 February 2022
on channel: Apple Coders
41,326
300

In this video, I want to show Android Studio New Update build.gradle not generate all project section Error Solution

when we create New Project in Android Studio Arctic Fox | 2020.3.1 Patch 1 or higher or 7.1.1 or 7.0.2 or 7.0.4 version build.gradle not generate `allprojects` section and causes error

In new release of Android, provide a new way to define your repositories. Before this release we used build.gradle(Project level) file to define repositories. Now you should write then into settings.gradle file.



there is solution of this error

Solution :

step 1 - go to Gradle Script
step 2- after that go to setting.gradle(Project Setting)
see the code settings.gradle file like below:

your old code here :

import org.gradle.api.initialization.resolve.RepositoriesMode

pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
// change here only
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter()
maven { url "https://jitpack.io" }
}
}

rootProject.name = "your app name"
include ':app'








replace
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
with
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)

or
RepositoriesMode.FAIL_ON_PROJECT_REPOS
replace with
RepositoriesMode.PREFER_SETTINGS





this is whole solution


after changed one line now your code look like this
this is your new code

import org.gradle.api.initialization.resolve.RepositoriesMode

pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
// change here only
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)

repositories {
google()
mavenCentral()
jcenter()
maven { url "https://jitpack.io" }
}
}

rootProject.name = "your app name"
include ':app'


Watch video Android Studio New Update build.gradle not generate all project section Error Solution online without registration, duration hours minute second in high quality. This video was added by user Apple Coders 09 February 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 41,326 once and liked it 300 people.