"Could not parse Android Application Module's Gradle config" in Android Studio? error

huangapple go评论136阅读模式
英文:

"Could not parse Android Application Module's Gradle config" in Android Studio? error

问题

I am developing jetpack compose android application using firebase but when I run project I am getting following exception

Could not parse the Android Application Module's Gradle config. Resolve gradle build issues and/or resync
I followed this answer link but it did not solve my problem

below my app.gradle file

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-kapt'
    id 'com.google.gms.google-services'
}

android {
    compileSdk 33

    defaultConfig {
        applicationId "com.example.firebasegooglesignjetpackcompose"
        minSdk 24
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary 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
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion '1.4.3'
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
    buildToolsVersion '33.0.0'
    ndkVersion '33.0.0'
}

dependencies {

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
    implementation 'androidx.activity:activity-compose:1.3.1'
    implementation "androidx.compose.ui:ui:$compose_ui_version"
    implementation "androidx.compose.ui:ui-tooling-preview:$compose_ui_version"
    implementation 'androidx.compose.material:material:1.2.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_ui_version"
    debugImplementation "androidx.compose.ui:ui-tooling:$compose_ui_version"
    debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_ui_version"
    implementation platform('com.google.firebase:firebase-bom:31.5.0')

    implementation 'com.google.firebase:firebase-auth-ktx:21.3.0'
    implementation 'com.google.android.gms:play-services-auth:20.5.0'

    implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.6.0"
    implementation "androidx.lifecycle:lifecycle-runtime-compose:2.6.0"
    implementation "androidx.navigation:navigation-compose:2.5.3"
    implementation "io.coil-kt:coil-compose:2.2.2"


}

below build.gradle

buildscript {
    ext {
        compose_ui_version = '1.4.0'
    }
    dependencies {
        classpath 'com.google.gms:google-services:4.3.15'
    }
}

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.2.1' apply false
    id 'com.android.library' version '7.2.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
    id 'com.google.gms.google-services' version '4.3.15' apply false
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

I want to know where I am making mistake I am using android studio bumbble version

<details>
<summary>英文:</summary>

I am developing jetpack compose android application using firebase but when I run project I am getting following exception 

Could not parse the Android Application Module&#39;s Gradle config. Resolve gradle build issues and/or resync
I followed this answer https://stackoverflow.com/questions/70883309/android-studios-project-gradle-file-changed but it did not solve my problem

below my app.gradle file

   

     plugins {
            id &#39;com.android.application&#39;
            id &#39;org.jetbrains.kotlin.android&#39;
            id &#39;kotlin-kapt&#39;
            id &#39;com.google.gms.google-services&#39;
        }
        
        android {
            compileSdk 33
        
            defaultConfig {
                applicationId &quot;com.example.firebasegooglesignjetpackcompose&quot;
                minSdk 24
                targetSdk 33
                versionCode 1
                versionName &quot;1.0&quot;
        
                testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;
                vectorDrawables {
                    useSupportLibrary true
                }
            }
        
            buildTypes {
                release {
                    minifyEnabled false
                    proguardFiles getDefaultProguardFile(&#39;proguard-android-optimize.txt&#39;), &#39;proguard-rules.pro&#39;
                }
            }
            compileOptions {
                sourceCompatibility JavaVersion.VERSION_1_8
                targetCompatibility JavaVersion.VERSION_1_8
            }
            kotlinOptions {
                jvmTarget = &#39;1.8&#39;
            }
            buildFeatures {
                compose true
            }
            composeOptions {
                kotlinCompilerExtensionVersion &#39;1.4.3&#39;
            }
            packagingOptions {
                resources {
                    excludes += &#39;/META-INF/{AL2.0,LGPL2.1}&#39;
                }
            }
            buildToolsVersion &#39;33.0.0&#39;
            ndkVersion &#39;33.0.0&#39;
        }
        
        dependencies {
        
            implementation &#39;androidx.core:core-ktx:1.7.0&#39;
            implementation &#39;androidx.lifecycle:lifecycle-runtime-ktx:2.3.1&#39;
            implementation &#39;androidx.activity:activity-compose:1.3.1&#39;
            implementation &quot;androidx.compose.ui:ui:$compose_ui_version&quot;
            implementation &quot;androidx.compose.ui:ui-tooling-preview:$compose_ui_version&quot;
            implementation &#39;androidx.compose.material:material:1.2.0&#39;
            testImplementation &#39;junit:junit:4.13.2&#39;
            androidTestImplementation &#39;androidx.test.ext:junit:1.1.5&#39;
            androidTestImplementation &#39;androidx.test.espresso:espresso-core:3.5.1&#39;
            androidTestImplementation &quot;androidx.compose.ui:ui-test-junit4:$compose_ui_version&quot;
            debugImplementation &quot;androidx.compose.ui:ui-tooling:$compose_ui_version&quot;
            debugImplementation &quot;androidx.compose.ui:ui-test-manifest:$compose_ui_version&quot;
            implementation platform(&#39;com.google.firebase:firebase-bom:31.5.0&#39;)
        
            implementation &#39;com.google.firebase:firebase-auth-ktx:21.3.0&#39;
            implementation &#39;com.google.android.gms:play-services-auth:20.5.0&#39;
        
            implementation &quot;androidx.lifecycle:lifecycle-viewmodel-compose:2.6.0&quot;
            implementation &quot;androidx.lifecycle:lifecycle-runtime-compose:2.6.0&quot;
            implementation &quot;androidx.navigation:navigation-compose:2.5.3&quot;
            implementation &quot;io.coil-kt:coil-compose:2.2.2&quot;
        
        
        }

below build.gradle

    buildscript {
        ext {
            compose_ui_version = &#39;1.4.0&#39;
        }
        dependencies {
            classpath &#39;com.google.gms:google-services:4.3.15&#39;
        }
    
    }// Top-level build file where you can add configuration options common to all sub-projects/modules.
    plugins {
        id &#39;com.android.application&#39; version &#39;7.2.1&#39; apply false
        id &#39;com.android.library&#39; version &#39;7.2.1&#39; apply false
        id &#39;org.jetbrains.kotlin.android&#39; version &#39;1.8.10&#39; apply false
        id &#39;com.google.gms.google-services&#39; version &#39;4.3.15&#39; apply false
    }
    task clean(type: Delete) {
        delete rootProject.buildDir
    }

I want to know where I am making mistake I am using android studio bumbble version


</details>


# 答案1
**得分**: 0

我通过将Android Studio版本从Bumble版本升级到Flamingo版本来解决了问题。

<details>
<summary>英文:</summary>

I fixed issue by updating android studio version from bumbble version to flamingo

</details>



huangapple
  • 本文由 发表于 2023年4月17日 17:35:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76033687.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定