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'


On this page of the site you can watch the video online Android Studio New Update build.gradle not generate all project section Error Solution with a duration of hours minute second in good quality, which was uploaded by the user Apple Coders 09 February 2022, share the link with friends and acquaintances, this video has already been watched 41,326 times on youtube and it was liked by 300 viewers. Enjoy your viewing!