Search code examples
firebaseandroid-studiobuild.gradlefirebase-assistantgradle-cache

Could not parse the Android Application Module's Gradle config ,While connecting to Firebase


I am getting this error ,While connecting the app to firebase from the firebase assistant in Android Studio. Error message -Could not parse the Android Application Module's Gradle config. Resolve gradle build issues and/or resync. I tried every posted Solution from Stack overflow and had watched many you tube videos , even cleared the gradle caches and also Updated the IDE. Even There is No error or Warning in my Gradle build files.

>build.gradle(app)

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

android {
    compileSdk 32

    defaultConfig {
        applicationId "com.project.PlacementInfo"
        minSdk 25
        targetSdk 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildFeatures {
        dataBinding = true

    }

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

dependencies {

    implementation 'com.google.android.gms:play-services-location:20.0.0'
    implementation 'com.google.firebase:firebase-analytics'
    implementation platform('com.google.firebase:firebase-bom:30.2.0')
    implementation 'androidx.appcompat:appcompat:1.4.2'
    implementation 'com.google.android.material:material:1.6.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'com.google.firebase:firebase-database:20.0.5'
    testImplementation 'junit:junit:'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

}

>build.gradle(Project)

// 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.4"
        classpath "com.android.tools.build:gradle:4.2.2"
        classpath 'com.google.gms:google-services:4.3.13'


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

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

Solution

  • Issue is resolved. Removed this line:

    testImplementation 'junit:junit:' 
    

    from build.gradle (app) and also downgrade the compile SDK from 32 to 31 and added following line:

    android.suppressUnsupportedCompileSdk=32
    

    in the gradle's properties(Project)