skip to Main Content

Firebase is not connecting and its show an error like Could not parse the Android Application Module’s Gradle config. Resolve gradle build issues and/or resync.

some people say to remove the jcenter()..But in my app gradle i didnt see any all projects repository
This is my application built.gradle…

// 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:7.0.0"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}`

3

Answers


  1. I had the same problem when trying to add a repository for "maven { url ‘https://jitpack.io’ }" with gradle 7.0.2.

    When I add the allprojects block: –

    allprojects {
        repositories {
            google()
            mavenCentral()
            maven { url 'https://jitpack.io' }
        }
    }
    

    I get the following error.

    A problem occurred evaluating root project ‘PetShop List’.

    Build was configured to prefer settings repositories over project repositories but repository ‘Google’ was added by build file ‘build.gradle’

    The reason is due to the dependencyResolutionManagement block in settings.gradle.

    To resolve it, simply go to "settings.gradle" file comment off the whole block for ‘dependencyResolutionManagement’.

    Then reSync your project and it should work.

    1. Solution1

    enter image description here

    1. Solution2

    enter image description here

    change like this in settings.gradle

    import org.gradle.api.initialization.resolve.RepositoriesMode
    
    dependencyResolutionManagement {
    
        repositories {
            google()
    //    notice here -------------------------
            repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
            //    notice here -------------------------
            mavenCentral()
            maven { url 'https://jitpack.io' }
            jcenter() // Warning: this repository is going to shut down soon
        }
    }
    rootProject.name = "My Application"
    include ':app'
    
    
    Login or Signup to reply.
  2. I had the same problem while adding "maven { url ‘https://jitpack.io’ }"
    I solved the issue by adding it to settings.gradle file as below,

    dependencyResolutionManagement {
        repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
        repositories {
            google()
            mavenCentral()
            jcenter() // Warning: this repository is going to shut down soon
            maven { url 'https://jitpack.io' }
        }
    }
    
    Login or Signup to reply.
  3. Go to setting.gradle file. Then add maven { url 'https://jitpack.io' } this line.

    dependencyResolutionManagement {
        repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
        repositories {
            google()
            mavenCentral()
            jcenter() // Warning: this repository is going to shut down soon
            maven { url 'https://jitpack.io' }
        }
    }
    

    enter image description here

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search