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?
in gradle-7.3 and lower method dependencyResolutionManagement have #Incubating annotation. To use this method in your settings.gradle or settings.gradle.kts file you need to add the line:
enableFeaturePreview("VERSION_CATALOGS")
This error can be caused by defining the dependencyResolutionManagement block in a build.gradle file instead of in the settings.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 :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and make comment these lines in settings.gardle(:) :
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
Note that Gradle Version better to be 6.6 for Gradle Plugin 4.1.3
Go to gradle/gradle-wrapper.properties and change your distributionUrl
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
Related
when I want to open or run a project , I get error below :
ERROR: Could not find com.android.tools.build:gradle:3.2.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar
Required by:
project :
Open File
and this is my build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
also by deffault , it contains google repo but the error is there .
I am running on ubuntu 19.1 , and follow the instructions but unfortunetly I can not solve this.
Thanks to Community.
I remember facing such problems, and surprisingly found out that I have network problem!
Here are steps may help you:
- check your system proxy settings.
- then, File -> invalid Cashes/Restart.
clear gradle cache
rm -rf $HOME/.gradle/caches
and resync to download all dependencies
Go Settings/Gradle/Android Studio. Then check "Enable embedded Maven repository". And you're good to go.
Try classpath 'com.android.tools.build:gradle:3.5.3'
also an unrelated addition, Kotlin is -> ext.kotlin_version = '1.3.61'
ERROR: Could not find com.android.tools.build:gradle:3.5.2.
Searched in the following locations:
-
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.2/gradle-3.5.2.pom
-
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.2/gradle-3.5.2.jar
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.2/gradle-3.5.2.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.2/gradle-3.5.2.jar
Required by:
project :
Open File
ext {
var = '3.5.2'
var1 = '3.5.2'
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
we recived this error from my android studio when run my projects
we used online and offline mod but they not worked corectly
This error has confused me
The following code is related to wrapper
ext {
var = '3.5.2'
var1 = '3.5.2'
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This problem basically occurs when you are trying to load an old project. The best solution as of my knowledge is to download the links one by one, the project is showing and sync it. Check out the build Gradle files for any outdated dependencies.
Check out if you have
google()
repo in your project. Make sure you find this line in your dependencies.
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
I also had this problem on Linux (ubuntu)
I tried different ways but the problem still didn't work out.
Finally, I remove /home/(user)/.gradle directory and restart Android Studio and this error fixed.
Follow these steps:
Copy paste the below code into Project level build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Clean your project from Build > Clean Project
Rebuild you project from Build > Rebuild Project
Make Project from Build > Make Project
Then, File > Invalidate Caches/Restart
I have problem with build project in android-studio from https://github.com/Samsung/microbit.
I imported repository by git, but while build gradle project from in android-studio I have error:
ERROR: Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.71.
I am not sure how I can change version 1.2.72 to other version.
Edit:
Solution:
I added mavenCentral() to
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
google()
}
}
I think there is no need to use that as you can use kotlin-stdlib directly.
Try this:
In your app level build.gradle file, under dependencies section:
dependencies{
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.41"
}
i can't fix tihs problem Failed to resolve: com.android.support:appcompat-v7:28.0.0
anybody can fix this problem?
My problem
buid.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
maven {
url 'https://maven.google.com/'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
First, check your build.gradle(Project), whether it was looking like below or not
Second, check your build.gradle(Module:app), whether it was looking like below or not
Please let me know, whether your issue has been resolved or not
Gradle is unable to resolve the com.android.support:design-v7:27.1.1 dependency, and I get the following error in Android Studio:
Failed to resolve: com.android.support:design-v7:27.1.1
enter image description here
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
There is no such artifact as com.android.support:design-v7:27.1.1. Gradle couldn't download (resolve) this dependency since it's not valid and not present in the maven repository.
Instead try this com.android.support:design:27.1.1, since this is the actual artifact.
Change this in your build.gradle and sync again. This should fix the issue.
EDIT:
The compile is obsolete and use implementation is not the issue here. But please use implementation instead of compile.
Try this:
The solution is to upgrade classpath com.google.gms:google-services to classpath 'com.google.gms:google-services:3.2.1' in file in build.gradle Project:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.2.1'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
it works