Anushka yadav
Anushka yadav

Reputation: 31

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
}

Upvotes: 1

Views: 451

Answers (2)

Anushka yadav
Anushka yadav

Reputation: 31

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)

Upvotes: 1

user19479375
user19479375

Reputation: 1

well here you have to add classpath in gradle level 1

    // 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.10'

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

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases"
        }
    }
}

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

then you have to add apply plugin in gradle level 2

below dependencies

 plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 31

    defaultConfig {
        applicationId "com.example.chatapp"
        minSdkVersion 23
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        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.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation platform('com.google.firebase:firebase-bom:29.2.1')
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-auth:21.0.1'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.google.firebase:firebase-firestore:24.1.0'
    implementation 'com.google.firebase:firebase-storage:20.0.1'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.firebaseui:firebase-ui-firestore:6.2.1'
    implementation 'com.firebaseui:firebase-ui-database:8.0.0'
    implementation 'com.google.firebase:firebase-database:20.0.4'

    implementation 'com.google.firebase:firebase-messaging:23.0.5'

    implementation ('org.jitsi.react:jitsi-meet-sdk:3.10.2') { transitive = true }

    implementation 'com.android.volley:volley:1.2.0'
    implementation 'com.google.firebase:firebase-appcheck-safetynet:16.0.0'

    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
apply plugin: 'com.google.gms.google-services'

source [here]

Upvotes: 0

Related Questions