Hello:) I am trying to build my java project and I keep on receiving the error below.

 build operation failed.
    Failed to notify dependency resolution listener.
Failed to notify dependency resolution listener.
org.gradle.api.artifacts.DependencySubstitutions$Substitution.with(Lorg/gradle/api/artifacts/component/ComponentSelector;)

I’ve tried changing version of gradle to all available version with no luck.

My Project (root) 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:4.1.2"
        classpath 'com.google.gms:google-services:4.3.5'

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

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
        maven { url "https://www.jitpack.io" }
    }
}

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


myapp build.gradle

plugins {
    id 'com.android.application'
    id 'com.google.gms.google-services'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.spacester.tweetster"
        minSdkVersion 21
        targetSdk 30
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.6.1'
    //noinspection GradleDependency,GradleDependency
    implementation 'com.google.firebase:firebase-auth:22.3.0'
    implementation 'com.google.firebase:firebase-database:20.3.0'
    implementation 'com.google.firebase:firebase-storage:20.3.0'
    implementation 'com.google.android.material:material:1.10.0'
    implementation 'com.android.support.constraint:constraint-layout:2.0.4'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'com.muddzdev:styleabletoast:2.2.4'
    //implementation project(path: ':nativetemplates')
    testImplementation 'junit:junit:4.13.1'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.hendraanggrian.appcompat:socialview:0.3-rc1'
    implementation 'com.github.bumptech.glide:glide:4.11.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
    implementation 'com.wang.avi:library:2.1.3'
    implementation 'com.android.volley:volley:1.2.1'
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'com.google.firebase:firebase-messaging:23.3.1'
    implementation 'com.github.tylersuehr7:social-text-view:1.0.0'
    implementation 'com.github.chrisbanes:PhotoView:2.1.4'
    //noinspection GradleDependency,GradleDependency
    implementation 'com.github.shts:StoriesProgressView:2.0.0'
    implementation 'io.agora.rtc:full-sdk:3.1.2'
    implementation 'com.joooonho:selectableroundedimageview:1.0.1'
    implementation 'com.hbb20:ccp:2.4.5'
    //implementation 'com.google.android.gms:play-services-ads:19.7.0'
}

You would need to look at the --stacktrace or a build --scan to see where exactly the problem comes from.
But something you use, my guess is Android Gradle Plugin, is not compatible with the Gradle version you use, as whathever it is tries to use with(...) which does not exist in recent versions of Gradle but was replaced by using(...).