I’m trying to use a project which my teacher gave to me, but it shows me an error
Settings file '/Users/admin/AndroidStudioProjects/HTTPNetworking/settings.gradle' line: 1
A problem occurred evaluating settings 'HTTPNetworking'.
> Could not find method dependencyResolutionManagement() for arguments [settings_d1xerae4a210x6r7efckrwyki$_run_closure1@580a3803] on settings 'HTTPNetworking' of type org.gradle.initialization.DefaultSettings.
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating settings 'HTTPNetworking'.
Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method dependencyResolutionManagement() for arguments [settings_d1xerae4a210x6r7efckrwyki$_run_closure1@580a3803] on settings 'HTTPNetworking' of type org.gradle.initialization.DefaultSettings
at settings_d1xerae4a210x6r7efckrwyki.run(/Users/admin/AndroidStudioProjects/HTTPNetworking/settings.gradle:1)
settings.gradle contains:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
}
}
rootProject.name = "HTTP Networking"
include ':app'
What’s wrong with it?
5
Answers
in
gradle-7.3
and lower methoddependencyResolutionManagement
have@Incubating
annotation. To use this method in yoursettings.gradle
orsettings.gradle.kts
file you need to add the line:This error can be caused by defining the
dependencyResolutionManagement
block in abuild.gradle
file instead of in thesettings.gradle
(which is where the doco clearly tells you to put it).Not that I did that or anything.
Feel free to upvote this answer if you also totally did not make that obviously dumb mistake.
This error could be caused due to having an older gradle-version, the issue got resolved for me after i upgraded my gradle version to 7.4.2 for my project
Copy and replace below codes in
Top-level build file
:and make comment these lines in settings.gardle(:) :
Note that
Gradle Version
better to be 6.6 forGradle Plugin
4.1.3Go to
gradle/gradle-wrapper.properties
and change yourdistributionUrl