Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I didnt see Allprojects repositories

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
}`
like image 233
surya surya Avatar asked Aug 11 '21 10:08

surya surya


People also ask

Where to add Gradle dependency?

Gradle declares dependencies on JAR files inside your project's module_name /libs/ directory (because Gradle reads paths relative to the build.gradle file). This declares a dependency on version 12.3 of the "app-magic" library, inside the "com.example.android" namespace group.

Where can I find the list of all local Git repositories?

You can find the list of all local git repositories by navigating from “ Git > Local Repositories .” Based on the previously configured folder for the local repos, Visual Studio will change the context for the local repositories.

What are artifact repositories in allprojects?

The repositories closure that you have in allprojects closure says "these are the artifact repositories from which to pull your own application dependencies ".

How to open Local repositories in Visual Studio?

Then, you will have all the local repos on your fingertip. You can select the repos to open them up in Visual Studio instantly. Chancing the context for the the local repositories can be done from separate place.

How to add Maven content to a repository closure?

The repositories closure in there serves the same basic role as the repositories closure in allprojects in the old system. So, add PayPal's maven {} content inside of the repositories closure in settings.gradle. Check in the Setting Gradle file. this file adds the new functionality to add the dependency resource


3 Answers

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' }
    }
}
like image 108
Daniel Waiguru Avatar answered Oct 23 '22 00:10

Daniel Waiguru


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'

like image 31
Angel Koh Avatar answered Oct 22 '22 23:10

Angel Koh


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

like image 37
SiamSaleh Avatar answered Oct 23 '22 00:10

SiamSaleh